我最初下载了FBSDK的4.10版,并将它们放在我的应用程序中,方法是将它们放在frameworks文件夹中.意识到这些不会随着时间的推移而更新,我完全删除它们并尝试将它们作为pod添加到我的项目中. pod已成功安装,我已在我的桥接头文件中正确导入它们,并且没有其他问题. pods更新安装版本4.11,这让我有些头疼.
我正在使用FBSDKLoginKit将用户登录到他们的帐户并从中检索信息.我能够收到一个包含用户信息的字典就好了.然后我将此信息传递给带有segue的下一个ViewController.在此之后的任何时候,如果我按下iPhone或模拟器上的主页按钮,应用程序将崩溃.我得到的错误是
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
如果我让用户通过Facebook登录,转到新视图控制器,展开到上一个视图控制器,然后再次尝试登录,也会发生此异常.我曾尝试在第二个屏幕上检索相关信息时将用户注销,但错误仍然存在.
我已经看到一个类似的问题,其中“解决方案”是FBSDKLoginKit将检索到的字典写入变量,如果它检索到的字典有nil值,则会抛出此错误.
在它发生之前我能做些什么才能抓住它?有人找到了解决方法吗?
当我按下主页时,这是模拟器的输出:
*** First throw call stack: ( 0 CoreFoundation 0x0000000106f03d85 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010643edeb objc_exception_throw + 48 2 CoreFoundation 0x0000000106e0023e -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318 3 CoreFoundation 0x0000000106e125bb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59 4 APPNAME 0x0000000101607a1e -[FBSDKTimeSpentData instanceSuspend] + 622 5 APPNAME 0x000000010160766b +[FBSDKTimeSpentData suspend] + 59 6 APPNAME 0x00000001015b5986 -[FBSDKAppEvents applicationMovingFromActiveStateOrTerminating] + 262 7 CoreFoundation 0x0000000106ecdc8c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 8 CoreFoundation 0x0000000106ecd9cb _CFXRegistrationPost + 427 9 CoreFoundation 0x0000000106ecd732 ___CFXNotificationPost_block_invoke + 50 10 CoreFoundation 0x0000000106f161e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1986 11 CoreFoundation 0x0000000106dc5679 _CFXNotificationPost + 633 12 Foundation 0x000000010372ccd9 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 13 UIKit 0x0000000104a685ad -[UIApplication _deactivateForReason:notify:] + 629 14 UIKit 0x0000000104a6f1f1 __61-[UIApplication _sceneSettingsPreLifecycleEventDiffInspector]_block_invoke + 104 15 FrontBoardServices 0x0000000108f88d6c __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke27 + 213 16 Foundation 0x000000010377d5bb __NSIndexSetEnumerate + 1016 17 BaseBoard 0x000000010901ba8c -[BSSettingsDiff inspectChangesWithBlock:] + 116 18 FrontBoardServices 0x0000000108f83e4a -[FBSSettingsDiff inspectOtherChangesWithBlock:] + 92 19 FrontBoardServices 0x0000000108f88b2f -[FBSSettingsDiffInspector inspectDiff:withContext:] + 317 20 UIKit 0x0000000104a70880 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 127 21 UIKit 0x0000000104a7052d -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 843 22 FrontBoardServices 0x0000000108f978c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24 23 FrontBoardServices 0x0000000108f97741 -[FBSSerialQueue _performNext] + 178 24 FrontBoardServices 0x0000000108f97aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45 25 CoreFoundation 0x0000000106e29301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 26 CoreFoundation 0x0000000106e1f22c __CFRunLoopDoSources0 + 556 27 CoreFoundation 0x0000000106e1e6e3 __CFRunLoopRun + 867 28 CoreFoundation 0x0000000106e1e0f8 CFRunLoopRunSpecific + 488 29 GraphicsServices 0x0000000108ae7ad2 GSEventRunModal + 161 30 UIKit 0x0000000104a72f09 UIApplicationMain + 171 31 APPNAME 0x00000001013a26d2 main + 114 32 libdyld.dylib 0x0000000107b0d92d start + 1 33 ??? 0x0000000000000001 0x0 + 1
)
libc abi.dylib:以NSException类型的未捕获异常终止
fbLoginManager.logInWithReadPermissions(permissionsNeeded,fromViewController: self) { (result,error) -> Void in //crashes before it enters this block //my code here }
在我甚至可以检查错误值之前它崩溃了.我将尝试通过步入fbsdk方法并更新来检查值
一旦我在这个屏幕上第二次按OK就会崩溃.我该怎么调试呢?该操作不在我的应用程序中,它在浏览器中,所以我不知道从哪里开始..