Facebook SDK登录在swift 2 iOS 9中引发错误 [英] Facebook SDK login throws error in swift 2 iOS 9

查看:413
本文介绍了Facebook SDK登录在swift 2 iOS 9中引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过iOS 9和Swift 2中的Facebook SDK进行简单的Facebook登录,但总是给我一个错误:


***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [NSTaggedPointerString
containsObject:]:发送到实例的无法识别的选择器
0xa326874756162667'




它发生在usr / include / dispatch / once.h中,我无法单独解决。有人有任何想法吗?



代码在这里:

 导入FBSDKCoreKit 
import FBSDKLoginKit


let loginManager = FBSDKLoginManager()
loginManager.logInWithReadPermissions([basic_info,email,user_likes],fromViewController: self.parentViewController,handler:{(result,error) - > Void in
if error!= nil {
print(FBSDKAccessToken.currentAccessToken())
} else if result.isCancelled {
print(Cancelled)
} else {
print(LoggedIn)
}
})
/ pre>

UPDATED:这是完整的错误堆栈:



  2015-10 -02 13:40:33.884 FacyNews [24902:1352812]  -  [NSTaggedPointerString containsObject:]:无法识别的选择器发送到实例0xa3268747561626672015-10-02 13:40:33.889 F acyNews [24902:1352812] ***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' -  [NSTaggedPointerString containsObject:]:无法识别的选择器发送到实例0xa326874756162667'***首次调用堆栈:( 0 CoreFoundation 0x000000010dbe8f65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010f87adeb objc_exception_throw + 48 2的CoreFoundation 0x000000010dbf158d  -  [NSObject的(NSObject的)doesNotRecognizeSelector:] + 205 3的CoreFoundation 0x000000010db3ef7a ___forwarding___ + 970 4的CoreFoundation 0x000000010db3eb28 _CF_forwarding_prep_0 + 120 5 FBSDKCoreKit 0x000000010d52ea8b + [FBSDKInternalUtility isRegisteredCanOpenURLScheme:] + 171 6 FBSDKCoreKit 0x000000010d52e8da + [FBSDKInternalUtility checkRegisteredCanOpenURLScheme:] + 362 7 FBSDKCoreKit 0x000000010d52d0ed _ _46 + [FBSDKInternalUtility isFacebookAppInstalled] _block_invoke + 45 8 libdispatch.dylib 0x0000000110ded49b _dispatch_client_callout + 8 9 libdispatch.dylib 0x0000000110dd8e28 dispatch_once_f + 543 10 FBSDKCoreKit 0x000000010d52cff7 + [FBSDKInternalUtility isFacebookAppInstalled] + 87 11 FBSDKLoginKit 0x000000010d6d6cb1  -  [FBSDKLoginManager logInParametersWithPermissions:] + 449 12 FBSDKLoginKit 0x000000010d6d7358  -  [ FBSDKLoginManager logInWithBehavior:] + 88 13 FBSDKLoginKit 0x000000010d6d72d4  -  [FBSDKLoginManager logInWithPermissions:处理程序:] + 292 14 FBSDKLoginKit 0x000000010d6d55e7  -  [FBSDKLoginManager logInWithReadPermissions:fromViewController:处理程序:] + 343个15 FacyNews 0x000000010d3a2e5c _TFFC8FacyNews20MasterViewController14viewWillAppearFS0_FSbT_U_FCSo13UIAlertActionT_ + 700个16 FacyNews 0x000000010d3a3297 _TTRXFo_oCSo13UIAlertAction_dT__XFo_iS__iT__ + 23个17 FacyNews 0x000000010d39e131 _TPA__TTRXFo_oCSo13UIAlertAction_dT__XFo_iS__iT__ + 81个18 FacyNews 0x000000010d3a2b40 _TTRXFo_iCSo13UIAlertAction_iT__XFo_oS__dT__ + 32个19 FacyNews 0x000000010d3a2b8c _TTRXFo_oCSo13UIAlertAction_dT__XFdCb_dS__dT__ + 60 20的UIKit 0x000000010e709fa5  -  [UIAlertController _fireOffActionOnTargetIfValidForAction:] + 96 21的UIKit 0x000000010e70a785 __85- [UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] _ block_invoke + 30 22 UIKit 0x000000010e55fc9f  -  [UIPresentationController transitionDidFinish:] + 1248 23 UIKit 0x000000010e563210 __56- [UIPresentationController runTransitionForCurrentState] _block_invoke_2 + 183 24 UIKit 0x000000010edb31e9  -  [_ UIViewControllerTransitionContext completeTransition:] + 101 25的UIKit 0x000000010e4a9daa  -  [UIViewAnimationBlockDelegate _didEndBlockAnimation:完成:上下文:] + 644 26的UIKit 0x000000010e4883a7  -  [UIViewAnimationState sendDelegateAnimationDidStop:完成:] + 241 27的UIKit 0x000000010e488756  -  [UIViewAnimationState animationDidStop:完成:] + 80 28 QuartzCore 0x00000001135e8d70 _ZN2CA5Layer23run_animation_callbacksEPv + 308 29个libdispatch.dylib 0x0000000110ded49b _dispatch_client_callout + 8 30 libdispatch.dylib 0x0000000110dd534b _dispatch_main_queue_callback_4CF + 1738 31的CoreFoundation 0x000000010db493e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 32的CoreFoundation 0x000000010db0a939 __CFRunLoopRun + 2073 33的CoreFoundation 0X 000000010db09e98 CFRunLoopRunSpecific + 488 34 GraphicsServices 0x00000001130a2ad2 GSEventRunModal + 161 35 UIKit 0x000000010e403676 UIApplicationMain + 171 36 FacyNews 0x000000010d39959d main + 109 37 libdyld.dylib 0x0000000110e2192d start + 1 38 ??? 0x0000000000000001 0x0 + 1)libc ++ abi.dylib:以NSException类型的未捕获异常终止 



提前感谢

解决方案

我已经解决了这个问题。由于在文档中没有任何关于LSApplicationQueriesSchemes的信息,但是我收到一个关于缺少的错误消息,我将该键和fbauth2值作为String写入info.plist,但它是一个数组,SDK尝试获取字符串数组的元素,如果是数组,则不进行任何检查。



但是,感谢您的帮助解答。


I tried to make a simple Facebook login with the Facebook SDK in iOS 9 and Swift 2 but it always throws me an error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xa326874756162667'

It occurs in the usr/include/dispatch/once.h and I can't solve it alone. Does somebody have any idea?

The code is here:

import FBSDKCoreKit
import FBSDKLoginKit


let loginManager = FBSDKLoginManager()
loginManager.logInWithReadPermissions(["basic_info", "email", "user_likes"], fromViewController: self.parentViewController, handler: { (result, error) -> Void in
    if error != nil {
        print(FBSDKAccessToken.currentAccessToken())
    } else if result.isCancelled {
        print("Cancelled")
    } else {
        print("LoggedIn")
    }
})

UPDATED: Here is the full error stack:

2015-10-02 13:40:33.884 FacyNews[24902:1352812] -[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xa326874756162667
2015-10-02 13:40:33.889 FacyNews[24902:1352812] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xa326874756162667'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010dbe8f65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x000000010f87adeb objc_exception_throw + 48
	2   CoreFoundation                      0x000000010dbf158d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
	3   CoreFoundation                      0x000000010db3ef7a ___forwarding___ + 970
	4   CoreFoundation                      0x000000010db3eb28 _CF_forwarding_prep_0 + 120
	5   FBSDKCoreKit                        0x000000010d52ea8b +[FBSDKInternalUtility isRegisteredCanOpenURLScheme:] + 171
	6   FBSDKCoreKit                        0x000000010d52e8da +[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:] + 362
	7   FBSDKCoreKit                        0x000000010d52d0ed __46+[FBSDKInternalUtility isFacebookAppInstalled]_block_invoke + 45
	8   libdispatch.dylib                   0x0000000110ded49b _dispatch_client_callout + 8
	9   libdispatch.dylib                   0x0000000110dd8e28 dispatch_once_f + 543
	10  FBSDKCoreKit                        0x000000010d52cff7 +[FBSDKInternalUtility isFacebookAppInstalled] + 87
	11  FBSDKLoginKit                       0x000000010d6d6cb1 -[FBSDKLoginManager logInParametersWithPermissions:] + 449
	12  FBSDKLoginKit                       0x000000010d6d7358 -[FBSDKLoginManager logInWithBehavior:] + 88
	13  FBSDKLoginKit                       0x000000010d6d72d4 -[FBSDKLoginManager logInWithPermissions:handler:] + 292
	14  FBSDKLoginKit                       0x000000010d6d55e7 -[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:] + 343
	15  FacyNews                            0x000000010d3a2e5c _TFFC8FacyNews20MasterViewController14viewWillAppearFS0_FSbT_U_FCSo13UIAlertActionT_ + 700
	16  FacyNews                            0x000000010d3a3297 _TTRXFo_oCSo13UIAlertAction_dT__XFo_iS__iT__ + 23
	17  FacyNews                            0x000000010d39e131 _TPA__TTRXFo_oCSo13UIAlertAction_dT__XFo_iS__iT__ + 81
	18  FacyNews                            0x000000010d3a2b40 _TTRXFo_iCSo13UIAlertAction_iT__XFo_oS__dT__ + 32
	19  FacyNews                            0x000000010d3a2b8c _TTRXFo_oCSo13UIAlertAction_dT__XFdCb_dS__dT__ + 60
	20  UIKit                               0x000000010e709fa5 -[UIAlertController _fireOffActionOnTargetIfValidForAction:] + 96
	21  UIKit                               0x000000010e70a785 __85-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:]_block_invoke + 30
	22  UIKit                               0x000000010e55fc9f -[UIPresentationController transitionDidFinish:] + 1248
	23  UIKit                               0x000000010e563210 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 183
	24  UIKit                               0x000000010edb31e9 -[_UIViewControllerTransitionContext completeTransition:] + 101
	25  UIKit                               0x000000010e4a9daa -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 644
	26  UIKit                               0x000000010e4883a7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241
	27  UIKit                               0x000000010e488756 -[UIViewAnimationState animationDidStop:finished:] + 80
	28  QuartzCore                          0x00000001135e8d70 _ZN2CA5Layer23run_animation_callbacksEPv + 308
	29  libdispatch.dylib                   0x0000000110ded49b _dispatch_client_callout + 8
	30  libdispatch.dylib                   0x0000000110dd534b _dispatch_main_queue_callback_4CF + 1738
	31  CoreFoundation                      0x000000010db493e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	32  CoreFoundation                      0x000000010db0a939 __CFRunLoopRun + 2073
	33  CoreFoundation                      0x000000010db09e98 CFRunLoopRunSpecific + 488
	34  GraphicsServices                    0x00000001130a2ad2 GSEventRunModal + 161
	35  UIKit                               0x000000010e403676 UIApplicationMain + 171
	36  FacyNews                            0x000000010d39959d main + 109
	37  libdyld.dylib                       0x0000000110e2192d start + 1
	38  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Thanks in advance.

解决方案

I have solved the problem. As there is no anything about LSApplicationQueriesSchemes in the documentation but I got an error message about the lack of it I wrote the key and the "fbauth2" value into the info.plist as a String but it is an array and the SDK try to get the element of the String Array without any check if it is an array.

However, thank you for the helping answers.

这篇关于Facebook SDK登录在swift 2 iOS 9中引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆