适用于iOS的FBSDK:“无法识别的选择器发送到实例”

时间:2015-04-09 14:17:39

标签: ios xcode facebook facebook-ios-sdk

集成Facebook SDK后,我在启动应用程序后立即收到以下错误: "无法识别的选择器发送到实例"

我做了什么:

我使用适用于iOS 8.2的XCode 6设置了一个简单的简单视图控制器应用程序,并将Facebook iOS SDK与Cocoapods集成在一起。

我通过"入门"部分并将nesseccary代码放入AppDelegate并更改.plist-File。 运行应用程序时,它会立即停止使用"无法识别的选择器" -Error。

我也试过了Example-App" Scrumptious"从Facebook-SDK,运行非常好。我将Scrumptions中的代码构建到我的应用程序中,并且遇到了和以前一样的错误。下面我将发布callstack。

Facebook建议-ObjC切换到链接器标志来解决这些错误。但是这个国旗已经确定了(我认为cocoapods已经确定了)。

我该怎么办?缺什么?

这是callstack:

2015-04-09 15:58:40.949 myapp[65629:2910713] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x7fbd6b741140'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000103205a75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000102e9ebb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010320cd1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00000001031649dc ___forwarding___ + 988
    4   CoreFoundation                      0x0000000103164578 _CF_forwarding_prep_0 + 120
    5   myapp                             0x0000000100993c66 __107+[FBSDKAppEventsUtility activityParametersDictionaryForEvent:implicitEventsOnly:shouldAccessAdvertisingID:]_block_invoke + 470
    6   libdispatch.dylib                   0x0000000104257614 _dispatch_client_callout + 8
    7   libdispatch.dylib                   0x0000000104243881 dispatch_once_f + 565
    8   myapp                             0x000000010099388a +[FBSDKAppEventsUtility activityParametersDictionaryForEvent:implicitEventsOnly:shouldAccessAdvertisingID:] + 1114
    9   myapp                             0x000000010099be4c +[FBSDKAppLinkUtility fetchDeferredAppLink:] + 780
    10  myapp                             0x0000000100974e6e -[AppDelegate applicationDidBecomeActive:] + 142
    11  UIKit                               0x0000000101bd3f96 -[UIApplication _stopDeactivatingForReason:] + 313
    12  UIKit                               0x0000000101be8ea2 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:] + 2648
    13  FrontBoardServices                  0x0000000105b33243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
    14  CoreFoundation                      0x000000010313ac7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    15  CoreFoundation                      0x00000001031309c5 __CFRunLoopDoBlocks + 341
    16  CoreFoundation                      0x0000000103130785 __CFRunLoopRun + 2389
    17  CoreFoundation                      0x000000010312fbc6 CFRunLoopRunSpecific + 470
    18  GraphicsServices                    0x0000000103b72a58 GSEventRunModal + 161
    19  UIKit                               0x0000000101bd9580 UIApplicationMain + 1282
    20  myapp                             0x00000001009753b3 main + 115
    21  libdyld.dylib                       0x000000010428c145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 个答案:

答案 0 :(得分:2)

看看你的plist-File。它必须包含FacebookAppId,DisplayName和URL Schemes。如果只有一个丢失,你会收到这样的错误。

以下是我使用Facebook-API正常运行的应用之一: Plist-File