stringWithContentsOfURL cookie jar in El Capitan
I have a small open source application.
[NSString stringWithContentsOfURL] to download website’s html and check if user has been logged in in Safari.
Before El Capitan everything was working fine:
stringWithContentsOfURL used sharedCookiesStorage (Safari ones) and returned the html of the page as logged in user.
But in El Capitan this is not working this way:
stringWithContentsOfURL returns the html of the page, where the user is not logged in. So it doesn’t use Safari’s cookies anymore. (I’m logged in on this page in Safari).
There were some changes in El Capitan, I had to add all my domains to
info.plist, so it could get data from http://, but I haven’t found any changes in
stringWithContentsOfURL in the latest OSX release.
What can be the problem? Everything was fine before upgrading. Maybe I could somehow pass
[NSHTTPCookieStorage sharedHTTPCookieStorage] to
The actual code, that gets html is:
html = [NSString stringWithContentsOfURL:[NSURL URLWithString: [trackerSettDict objectForKey:@"loginCheckURL"]] encoding: NSUTF8StringEncoding error:&error];
Some code to test the error:
NSError *error; NSString *html; html = [NSString stringWithContentsOfURL:[NSURL URLWithString: @"https://google.com"] encoding: NSWindowsCP1251StringEncoding error:&error]; NSLog(@"%@", html);
Solutions Collect From Internet About “stringWithContentsOfURL cookie jar in El Capitan”
In El Capitan, each app has its own cookie storage. You can access Safari’s cookie storage by
- How to determine binary image architecture at runtime?
- What are “Imported UTIs” in Xcode 4?
- iPhone:How to crop image in ios5
- AppDelegate to UIViewController
- Creating levels in an iOS Sprite Kit Game
- Upload Photo / File with JSON and custom headers via Swift 3 and Alamofire 4 | iOS | Swift
- iOS: what is the equivalent of an event listener in Objective-C?
- How to download video from url and save it in to document directory in iOS?
- UIScrollView not scrolling with UItextfields
- circle image in cell imageView and how to resize it?
- Navigation bar disappears if reload data with UISearchController
- create movie from , Swift
- Add glowing effect to an SKSpriteNode
- Is it safe to schedule and invalidate NSTimers on a GCD serial queue?
- Does fast enumeration in Objective-C guarantee the order of iteration?