![](/img/trans.png)
[英]canOpenURL returning true for custom URL scheme even if app is not installed
[英]My App is asking for plenty url's with CanOpenUrl
我的應用程序有問題,當我嘗試構建應用程序時,它總是向我顯示控制台中的代碼。
2015-10-30 15:24:36.673 MyApp[578:53278] -canOpenURL: failed for URL:
"fb206891282674529:" - error: "This app is not allowed to query for scheme fb206891282674529"
2015-10-30 15:24:36.675 MyApp[578:53278] -canOpenURL: failed for URL: "fb439505206066620:" - error: "This app is not allowed to query for scheme fb439505206066620"
2015-10-30 15:24:36.676 MyApp[578:53278] -canOpenURL: failed for URL: "ayi:" - error: "This app is not allowed to query for scheme ayi"
2015-10-30 15:24:36.677 MyApp[578:53278] -canOpenURL: failed for URL: "bikerace:" - error: "This app is not allowed to query for scheme bikerace"
2015-10-30 15:24:36.679 MyApp[578:53278] -canOpenURL: failed for URL: "db-lqycrgwnyt23sgf:" - error: "This app is not allowed to query for scheme db-lqycrgwnyt23sgf"
2015-10-30 15:24:36.681 MyApp[578:53278] -canOpenURL: failed for URL: "hulu:" - error: "This app is not allowed to query for scheme hulu"
2015-10-30 15:24:36.684 MyApp[578:53278] -canOpenURL: failed for URL: "skout:" - error: "This app is not allowed to query for scheme skout"
2015-10-30 15:24:36.686 MyApp[578:53278] -canOpenURL: failed for URL: "abcplayer:" - error: "This app is not allowed to query for scheme abcplayer"
2015-10-30 15:24:36.688 MyApp[578:53278] -canOpenURL: failed for URL: "dg028:" - error: "This app is not allowed to query for scheme dg028"
2015-10-30 15:24:36.689 MyApp[578:53278] -canOpenURL: failed for URL: "ilsgt:" - error: "This app is not allowed to query for scheme ilsgt"
2015-10-30 15:24:36.690 MyApp[578:53278] -canOpenURL: failed for URL: "gpappsptrackerlite:" - error: "This app is not allowed to query for scheme gpappsptrackerlite"
2015-10-30 15:24:36.691 MyApp[578:53278] -canOpenURL: failed for URL: "cupcake:" - error: "This app is not allowed to query for scheme cupcake"
2015-10-30 15:24:36.693 MyApp[578:53278] -canOpenURL: failed for URL: "fb179837925402275:" - error: "This app is not allowed to query for scheme fb179837925402275"
2015-10-30 15:24:36.694 MyApp[578:53278] -canOpenURL: failed for URL: "tocastore:" - error: "This app is not allowed to query for scheme tocastore"
還有許多其他...我的iPhone上沒有這些應用程序。 我已經在手機中重新安裝了OS X和iOS。 我已經在網上搜索了有關此問題的信息,但我仍然對此感到困惑。 這是我安裝的CocoaPods的列表:
platform :ios, '7.0'
pod "AFNetworking", '< 2.1'
pod "YandexMobileMetrica", '~>1.6.2'
pod "iOS-Slide-Menu"
pod 'SDWebImage', '~>3.7'
pod "FSOAuth", ‘< 1.2’
#pod 'AF2OAuth1Client', :git => 'https://github.com/joelchen/AFOAuth1Client.git'
pod 'JBChartView'
pod 'CCBottomRefreshControl'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'GoogleMaps'
有人知道該怎么辦嗎?
如果未在Info.plist中加入白名單,則在iOS 9中不再允許調用canOpenURL:
似乎您使用的某些庫嘗試使用UIApplication canOpenURL:
從iOS 9.0開始,您需要在Info.plist中為每個URL方案添加條目。 附加內容如下所示:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb439505206066620</string>
<string>ayi</string>
</array>
為您在日志中看到的每個方案添加一行。 方案名稱中不要包含冒號。
請注意,即使有這些條目,如果您沒有為這些方案中的一個或多個安裝相應的應用程序,您也會看到略有不同的錯誤消息。 可以放心地忽略它們。
實際上,您不需要添加所有這些。 盡管取決於庫及其使用給定方案的方式,但庫可能無法正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.