此錯誤「此應用不允許查詢計劃googlechrome」,表示您沒有將計劃添加到您應用的.plist
文件中。您可能還需要向plist添加另一個名爲LSApplicationQueriesSchemes的註冊表項,並將其作爲字符串項添加到「itms-books」方案中,以允許canOpenURL對其進行測試。請注意,如果您嘗試在實際設備上運行它會更好。
<key>LSApplicationQueriesSchemes</key>
<array>
<string>xxx</string>
</array>
從這個SO ticket的iOS 9以已經做了小改動,以URL方案的處理。您必須將應用程序調用的網址列入白名單,以便使用Info.plist中的LSApplicationQueriesSchemes項。
The main conclusion is that if you call the canOpenURL
method on a URL that is not in your whitelist, it will return NO
, even if there is an app installed that has registered to handle this scheme. A This app is not allowed to query for scheme xxx
syslog entry will appear.
If you call the openURL
method on a URL that is not in your whitelist, it will fail silently. A This app is not allowed to query for scheme xxx
syslog entry will appear.