iPhone NSData/NSUrl with cookie

前端 未结 1 1537
既然无缘
既然无缘 2021-01-07 00:58

I\'m trying to play/stream a mp3 hosted on a website. The site requires a cookie header to be set, but I\'m having trouble setting that or getting the container to do that

1条回答
  •  花落未央
    2021-01-07 01:42

    Ok, so the way to do this is not injecting headers but setting a cookie manager to always accept cookies. This will then pass on the cookie to subsequent requests.

        NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
        [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
    

    Robbie

    0 讨论(0)
提交回复
热议问题