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);
- Best way to implement Enums with Core Data in Swift
- How do I call methods in a class that I created dynamically with NSClassFromString?
- Number of occurrences of a substring in an NSString?
- How to use NSTitlebarAccessoryViewController?
- Hidden Features of Xcode 4
- NSCollectionView with sections - like in iPhoto
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 use MBProgressHUD with swift
- Cordova trying to dial telephone number
- Core Data data schema from existing SQLite database
- Alamofire4 trouble with JSONResponseSerializer & HTTPURLResponse Swift 3.0
- Can't get UICollectionView to display cells
- Is it possible to stub HTTP requests in Xcode 7 automated UI tests?
- React-Native ios App crashes without report
- How to make a multiple line, left-aligned UIAlertView?
- iOS: How do I detect if music is playing in any background music app?
- How to swap views using a swipe gesture XCode
- Using sysctlbyname() from Swift
- Screen size of iphone 5
- Mock API Requests Xcode 7 Swift Automated UI Testing
- How Can I Draw Image with Text Wrapping on iOS?
- How to create ipa without Apple Developer Progromammer in Xcode7