Posts

Post not yet marked as solved
13 Replies
I've found the root cause. I'm using cocoapods and one of dependencies waspod 'CCInfiniteScrolling', :git => 'https://github.com/Dalein/CCInfiniteScrolling.git', :branch => 'daleijn'Exacly this pod somehow throws an ATS error.You can easily repeat it. just create new Objc project, add Allow Arbitrary Loads = true.ThenPod:platform :ios, :deployment_target => '9.3' # ignore all warnings from all pods inhibit_all_warnings! def all_pods pod 'CCInfiniteScrolling', :git => 'https://github.com/Dalein/CCInfiniteScrolling.git', :branch => 'daleijn' end target "TestNetworking" do all_pods end post_install do |installer| installer.pods_project.build_configurations.each do |config| config.build_settings.delete('CODE_SIGNING_ALLOWED') config.build_settings.delete('CODE_SIGNING_REQUIRED') end endThen add in vc:NSURL *url = [NSURL URLWithString:@"http:/..."]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; [[NSURLSession.sharedSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"responseString: %@ | error: %@", responseString, error); }] resume];And you'll see the ATS error.
Post not yet marked as solved
13 Replies
Yep, in simulator I see the same:Cannot start load of Task <...>.<3> since it does not conform to ATS policy2019-09-10 14:17:21.778761+0500 Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x600001395140 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://..., NSErrorFailingURLKey=http://..., NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
Post not yet marked as solved
13 Replies
It's look like this:<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
Post not yet marked as solved
13 Replies
Very strange, I see this ATS error message only in legacy project. I thought the problem is caused by old AFNetworking lib that I use here. But I added this code in one of my vc:NSURL *url = [NSURL URLWithString:@"http:// some http address"]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; [[NSURLSession.sharedSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"responseString: %@ | error: %@", responseString, error); }] resume];And I saw this again:Cannot start load of Task <A7D75915-79A7-447D-AFB3-F500C02A985A>.<3> since it does not conform to ATS policy2019-07-18 16:59:06.866724+0500 rosneft-brands[86437:9533719] responseString: | error: Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x600000c66280 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://some http address, NSErrorFailingURLKey=http://some http address, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}How could it be? Something wrong with project itself? Exactly for iOS 13