Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-canOpenURL: failed for URL: "itms-books://" - error: "This app is not allowed to query for scheme itms-books"

Tags:

ios9

xcode7

I just Start xcode 7 stable version. In my current project I am downloading images from webservice. In xcode 6.4 was working fine. Now it's not showing any image and show warning in log

-canOpenURL: failed for URL: "itms-books://" - error: "This app is not allowed to query for scheme itms-books"

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

like image 262
bhautikmewada191 Avatar asked Sep 23 '15 04:09

bhautikmewada191


3 Answers

This is a new enforced security measure that apple has implemented on any app that is build in iOS 9.

The only solution so far is to add an entry in the info.plist file with the Key LSApplicationQueriesSchemes and add "itms-books" and any other url scheme that your app will be linking to in this array.

LSApplicationQueriesSchemes

The main explanation for this move from apple is that some apps used to exploit the functionality of the canOpenURL: method to scan which apps where installed in your phone to target you with selective ads or other "not so benevolent" motives.

Keep in mind that there is a cap in the amount of apps you can register which is 50.

like image 166
Juan Reyes Avatar answered Oct 02 '22 20:10

Juan Reyes


You might also need to add to the plist another key called LSApplicationQueriesSchemes (type array) And add the 'itms-books' scheme to it as a string item, to allow the canOpenURL to test against it.

like image 29
AShavit Avatar answered Oct 02 '22 20:10

AShavit


I found my issue i was added key in info.plist file.

Add Dictionary NSAppTransportSecurity -> add new boolean key name NSAllowsArbitraryLoads in project's info.plist file.

like image 30
bhautikmewada191 Avatar answered Oct 02 '22 18:10

bhautikmewada191