【问题标题】:React Native FBSDK unrecognized selector sent to instanceReact Native FBSDK无法识别的选择器发送到实例
【发布时间】:2016-12-29 07:20:04
【问题描述】:

我正在尝试让 react-native FBSDK 工作。具有讽刺意味的是,之前没有任何更改的相同代码(我什至有登录工作的屏幕记录)但是自从重新启动 xcode 和模拟器后,我在应用启动时收到了这个崩溃。

我仔细检查以确保我正确执行了安装步骤。我还用 cocoapods 切换了手动下载的版本,但同样的错误

2016-12-29 16:13:46.067 myapp[13521:2804102] Falling back to loading access token from NSUserDefaults because of simulator bug
2016-12-29 16:13:46.067 myapp[13521:2804102] -[NSConcreteMutableData isEqualToString:]: unrecognized selector sent to instance 0x610000050bc0
2016-12-29 16:13:46.076 myapp[13521:2804102] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableData isEqualToString:]: unrecognized selector sent to instance 0x610000050bc0'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000105915d4b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010479921e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000105985f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x000000010589b005 ___forwarding___ + 1013
    4   CoreFoundation                      0x000000010589ab88 _CF_forwarding_prep_0 + 120
    5   FBSDKCoreKit                        0x0000000103f9db1a -[FBSDKAccessTokenCacheV4 fetchAccessToken] + 202
    6   FBSDKCoreKit                        0x0000000103f9c0ec -[FBSDKAccessTokenCache fetchAccessToken] + 92
    7   FBSDKCoreKit                        0x0000000103faaded -[FBSDKApplicationDelegate application:didFinishLaunchingWithOptions:] + 125
    8   songchat                            0x0000000103b8c852 -[AppDelegate application:didFinishLaunchingWithOptions:] + 130
    9   UIKit                               0x0000000107ea13c2 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
    10  UIKit                               0x0000000107ea2d47 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
    11  UIKit                               0x0000000107ea90ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
    12  UIKit                               0x0000000107ea626d -[UIApplication workspaceDidEndTransaction:] + 188
    13  FrontBoardServices                  0x000000010b56f6cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    14  FrontBoardServices                  0x000000010b56f544 -[FBSSerialQueue _performNext] + 189
    15  FrontBoardServices                  0x000000010b56f8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    16  CoreFoundation                      0x00000001058ba761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    17  CoreFoundation                      0x000000010589f98c __CFRunLoopDoSources0 + 556
    18  CoreFoundation                      0x000000010589ee76 __CFRunLoopRun + 918
    19  CoreFoundation                      0x000000010589e884 CFRunLoopRunSpecific + 420
    20  UIKit                               0x0000000107ea4aea -[UIApplication _run] + 434
    21  UIKit                               0x0000000107eaac68 UIApplicationMain + 159
    22  songchat                            0x0000000103b8ce8f main + 111
    23  libdyld.dylib                       0x0000000109e0f68d start + 1
    24  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

【问题讨论】:

  • 重启模拟器或在另一个模拟器中运行代码
  • @KAR 果然,切换模拟器或重置现有模拟器确实有效,但导致此问题的原因是什么,我该如何避免遇到它?实际设备是否有可能发生这种情况?
  • 这是模拟器导致的错误。我认为模拟器中存在一些错误。
  • 或在模拟器中重新安装应用

标签: ios react-native facebook-sdk-4.0


【解决方案1】:

我认为您错过了在应用的 Info.plist 中添加这些内容。

<key>FacebookAppID</key>
<string>Your_App_ID</string>
<key>FacebookDisplayName</key>
<string>Your_App_Display_Name</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

【讨论】:

    【解决方案2】:

    对我来说,因为我使用 cocoapods 进行链接,删除手动链接解决了这个问题。

    也就是说,转到 Xcode > Project Root > Build Phases > Link Binary with Libraries 并删除 Facebook Core/Login 等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-28
      • 2012-07-24
      相关资源
      最近更新 更多