Parse platform swift 2解析facebookSDK ios9
我正在尝试通过Facebook登录用户。在以前版本的swift 1.2中,一切都运行得很好,但在迁移之后,我似乎无法通过我的FB帐户登录,我仍然收到一个错误提示: -canOpenURL:URL失败:fbauth://authorize/?client_id=... 错误:“不允许此应用查询方案fbauth” 你能帮我吗?从WWDC 2015“隐私和你的应用”视频中,将以下内容添加到你的info.plist文件中:Parse platform swift 2解析facebookSDK ios9,parse-platform,facebook-sdk-4.0,swift2,Parse Platform,Facebook Sdk 4.0,Swift2,我正在尝试通过Facebook登录用户。在以前版本的swift 1.2中,一切都运行得很好,但在迁移之后,我似乎无法通过我的FB帐户登录,我仍然收到一个错误提示: -canOpenURL:URL失败:fbauth://authorize/?client_id=... 错误:“不允许此应用查询方案fbauth” 你能帮我吗?从WWDC 2015“隐私和你的应用”视频中,将以下内容添加到你的info.plist文件中: <key>LSApplicationQueriesSchem
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth</string>
</array>
LSApplicationQueriesSchemes
fbauth
我建议按照Facebook的说明为iOS 9准备应用程序:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
NSAppTransportSecurity
NSExceptionDomains
facebook.com
n包括多个域
NSExceptionRequiresForwardSecretary
fbcdn.net
n包括多个域
NSExceptionRequiresForwardSecretary
akamaihd.net
n包括多个域
NSExceptionRequiresForwardSecretary
或者您将遇到以下错误:
NSUnderlyingError=0x7f88f9436eb0 {Error Domain=kCFErrorDomainCFNetwork
Code=-1200 "An SSL error has occurred and a secure connection to
the server cannot be made." UserInfo={NSErrorFailingURLStringKey=
https://graph.facebook.com/v2.4, NSLocalizedRecoverySuggestion=
Would you like to connect to the server anyway?,
_kCFNetworkCFStreamSSLErrorOriginalValue=-9802,
kCFStreamPropertySSLPeerCertificates=<CFArray 0x7f88f9536e00
[0x10719f7c0]>{type = immutable, count = 2, values = (
0 : <cert(0x7f88f963f840) s: *.facebook.com (http://facebook.com/)
i: DigiCert High Assurance CA-3>
1 : <cert(0x7f88f96444c0) s: DigiCert High Assurance CA-3 i:
DigiCert High Assurance EV Root CA> )},
_kCFStreamPropertySSLClientCertificateState=0,
kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x7f88f9644d10>,
NSLocalizedDescription=An SSL error has occurred and a secure connection
to the server cannot be made.,_kCFStreamErrorDomainKey=3,
NSErrorFailingURLKey=https://graph.facebook.com/v2.4,
_kCFStreamErrorCodeKey=-9802}}
NSUnderlyingError=0x7f88f9436eb0{Error Domain=KCFerrorDomainIncfNetwork
Code=-1200“发生SSL错误,并且安全连接到
无法创建服务器。“UserInfo={NSErrorFailingURLStringKey”=
https://graph.facebook.com/v2.4,NSLocalizedRecoverySuggestion=
是否仍要连接到服务器?,
_KCFnetworkCfsStreamsLerrorOriginalValue=-9802,
KCFStreamPropertySLpeerCertificates={type=immutable,count=2,值=(
0 :
1 : )},
_kCFStreamPropertySSLClientCertificateState=0,
KCFStreamPropertySLpeertrust=,
NSLocalizedDescription=发生SSL错误,并且连接安全
无法向服务器发送数据。,kCFStreamErrorDomainKey=3,
N错误失效键=https://graph.facebook.com/v2.4,
_kCFStreamErrorCodeKey=-9802}
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
LSApplicationQueriesSchemes
fbapi
fbapi20130214
fbapi20130410
fbapi20130702
fbapi20131010
fbapi20131219
fbapi20140410
fbapi20140116
fbapi20150313
fbapi20150629
fbauth
fbauth2
fb-messenger-api20140430
如果您使用的FBSDKMessengerShareKit版本早于v4.6版本,请同时添加
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
fb-messenger-platform-20150128
fb-messenger-platform-20150218
fb-messenger-platform-20150305
如果您使用的是SDK的v4.6.0,则只需添加:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
LSApplicationQueriesSchemes
fbapi
fb messenger api
fbauth2
fbshareextension
这将允许FacebookSDK集成正确识别已安装的Facebook应用程序以执行应用程序切换。如果您不使用iOS SDK 9.0重新编译,您的应用程序将被限制为50个不同的方案(之后调用canOpenURL返回否)。1]在Developer.Facebook中进行身份验证并生成Facebook Id 2] 设置位代码:生成设置中的否 3] 设置Plist文件
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb460481580805052</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>460481580805052</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2 </string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
</array>
点击此链接查看Facebook推荐的iOS 9更新 为了修复此特定错误
-canOpenURL: failed for URL: "fbauth://authorize/?client_id=... error: "This app is not allowed to query for scheme fbauth"
对于Facebook SDK 4.6+版,请转到info.plist文件并添加以下内容:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
LSApplicationQueriesSchemes
fbapi
fb messenger api
fbauth2
fbshareextension
对于版本4.5或更高版本:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
LSApplicationQueriesSchemes
fbapi
fbapi20130214
fbapi20130410
fbapi20130702
fbapi20131010
fbapi20131219
fbapi20140410
fbapi20140116
fbapi20150313
fbapi20150629
fbauth
fbauth2
fb-messenger-api20140430
为什么会有这些缺点?所以没有理由。iOS9对查询方案增加了一些限制。我相信这是出于隐私考虑-应用程序可以看到您在手机上安装的内容,即使它们无意为给定方案启动url。因此,我不可能在iOS9上继续开发在更新这些框架之前,请尝试以下方法。在Xcode 7中为iOS 9创建一个新的Swift 2.0应用程序。在AppDelegate.Swift文件中,添加let sharedApplication=UIApplication.sharedApplication();let isFacebookAuthorized=sharedApplication.canOpenURL(NSURL(fileURLWithPath:)fbauth://authorize"));
进入didFinishLaunchingWithOptions。生成并运行。您应该获得“不允许查询方案”选项“错误。接下来,打开Info.plist作为源代码,并将原始回复中的代码插入到
前面的文件中。重建并运行。您不应该再收到错误。我现在回到Xcode 6,将等待Parse和FBSDK实际发布一个新版本,该版本将在iOS9上运行,并且还使用BitCode构建了库。可以在此处找到一个工作代码示例:得到相同的问题,在将其添加到Info.plist后,我得到了以下结果:-canOpenURL:URL失败:"fbauth://authorize/?client_id=…“-错误:”(null)”,似乎FBSDK出了什么问题。@nebiros据我所知,错误:“(nu)”