当使用Facebook登录时,SWIFT:“终止于类型为NSException的未捕获异常”
问题描述:
我正在开发一个小型应用程序,该应用程序支持用户使用Facebook登录,与使用Facebook登录相关的大部分代码从this website当使用Facebook登录时,SWIFT:“终止于类型为NSException的未捕获异常”
但是引用,当我编译的代码有错误:
> 2015-11-06 15:38:38.357 eber_ios[1048:31523] *** Terminating app due
> to uncaught exception 'InvalidOperationException', reason: 'fbauth2 is
> missing from your Info.plist under LSApplicationQueriesSchemes and is
> required for iOS 9.0'
> *** First throw call stack: ( 0 CoreFoundation 0x0000000101369f65 __exceptionPreprocess + 165 1 libobjc.A.dylib
> 0x0000000103220deb objc_exception_throw + 48 2 eber_ios
> 0x00000001010d14d1 __56+[FBSDKInternalUtility
> checkRegisteredCanOpenURLScheme:]_block_invoke + 0 3
> libdispatch.dylib 0x0000000103d0449b
> _dispatch_client_callout + 8 4 libdispatch.dylib 0x0000000103cefe28 dispatch_once_f + 543 5 eber_ios
> 0x00000001010d067f +[FBSDKInternalUtility isFacebookAppInstalled] +
> 241 6 eber_ios 0x00000001010b65ba
> -[FBSDKLoginManager logInParametersWithPermissions:] + 360 7 eber_ios 0x00000001010b6991
> -[FBSDKLoginManager logInWithBehavior:] + 50 8 eber_ios 0x00000001010b6949 -[FBSDKLoginManager logInWithPermissions:handler:]
> + 238 9 eber_ios 0x00000001010b5667 -[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:] + 257 10
> eber_ios 0x00000001010b2135
> -[FBSDKLoginButton _buttonPressed:] + 1082 11 UIKit 0x0000000101dab1fa -[UIApplication sendAction:to:from:forEvent:] + 92
> 12 UIKit 0x0000000101f0f504
> -[UIControl sendAction:to:forEvent:] + 67 13 UIKit 0x0000000101f0f7d0 -[UIControl _sendActionsForEvents:withEvent:] + 311
> 14 UIKit 0x0000000101f0e906
> -[UIControl touchesEnded:withEvent:] + 601 15 UIKit 0x0000000101e15aa3 -[UIWindow _sendTouchesForEvent:] + 835 16 UIKit
> 0x0000000101e16691 -[UIWindow sendEvent:] + 865 17 UIKit
> 0x0000000101dc8752 -[UIApplication sendEvent:] + 263 18 UIKit
> 0x0000000101da3fcc _UIApplicationHandleEventQueue + 6693 19
> CoreFoundation 0x00000001012960a1
> __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 20 CoreFoundation 0x000000010128bfcc
> __CFRunLoopDoSources0 + 556 21 CoreFoundation 0x000000010128b483 __CFRunLoopRun + 867 22 CoreFoundation
> 0x000000010128ae98 CFRunLoopRunSpecific + 488 23 GraphicsServices
> 0x0000000106816ad2 GSEventRunModal + 161 24 UIKit
> 0x0000000101da9676 UIApplicationMain + 171 25 eber_ios
> 0x00000001010b137d main + 109 26 libdyld.dylib
> 0x0000000103d3892d start + 1 27 ???
> 0x0000000000000001 0x0 + 1) libc++abi.dylib: terminating with
> uncaught exception of type NSException
是什么原因导致这个错误,我该如何解决?我正在使用FacebookSDK 4.1。
谢谢。
答
感谢安东尼,我增加了以下关键
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
</array>
到Info.plist中,它的工作。谢谢。
错误消息是'fbauth2从你的Info.plist中缺少LSApplicationQueriesSchemes并且是iOS 9.0''所必需的'看看http://*.com/questions/32006033/ios-9-fbauth2-missing-从-INFO-的plist –