Last active
December 23, 2015 14:59
-
-
Save steveriggins/6652508 to your computer and use it in GitHub Desktop.
iOS 7 has a bug (or made a design decision which goes against the documentation) to set the cookie policy of NSURLConnections to whatever the user has set their cookie preferences to via Settings -> Safari. This simple method resets the cookie policy to accept always. Apple documentation for cookieAcceptPolicy: https://developer.apple.com/librar…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)takeControlOfTheCookies | |
{ | |
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; | |
} | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
[self takeControlOfTheCookies]; | |
// ... | |
} | |
// If you want to be extra sure... | |
- (void)applicationWillEnterForeground:(UIApplication *)application | |
{ | |
[self takeControlOfTheCookies]; | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment