thebergamo / react-native-fbsdk-next

MIT License
664 stars 165 forks source link

unrecognized selector sent to instance in [FBSDKModelManager enable] #400

Closed matanume closed 1 year ago

matanume commented 1 year ago

🐛 Bug Report

I upgrade expo project from 47 to 48 then this error occur from nowhere. Even if I try to disable all code and return only empty view in javascript side. The crash still occur.

-[__NSCFNumber count]: unrecognized selector sent to instance

0 CoreFoundation 0x00000001ab7a8e44 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 40516 1 libobjc.A.dylib 0x00000001a493f8d8 objc_exception_throw + 60 2 CoreFoundation 0x00000001ab91d81c 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 1566748 3 CoreFoundation 0x00000001ab7bef50 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 130896 4 CoreFoundation 0x00000001ab827320 _CF_forwarding_prep_0 + 96 5 FBSDKCoreKit 0x000000010591917c 27-[FBSDKModelManager enable]_block_invoke + 500 6 libdispatch.dylib 0x0000000105e85ff0 _dispatch_client_callout + 20 7 libdispatch.dylib 0x0000000105e87b60 _dispatch_once_callout + 136 8 FBSDKCoreKit 0x0000000105918f84 -[FBSDKModelManager enable] + 104 9 FBSDKCoreKit 0x00000001058de078 43-[FBSDKAppEvents fetchServerConfiguration:]_block_invoke_4 + 56 10 FBSDKCoreKit 0x00000001059746e4 $s12FBSDKCoreKit15_FeatureManagerC5check_15completionBlockySo12FBSDKFeatureV_ySbctFys5Error_pSgcfU_TA + 44 11 FBSDKCoreKit 0x00000001059735c8 $ss5Error_pSgIegg_So7NSErrorCSgIeyBy_TR + 52 12 FBSDKCoreKit 0x00000001059034b8 +[FBSDKGateKeeperManager loadGateKeepers:] + 604 13 FBSDKCoreKit 0x00000001059734e0 $s12FBSDKCoreKit15_FeatureManagerC5check_15completionBlockySo12FBSDKFeatureV_ySbctF + 660 14 FBSDKCoreKit 0x0000000105973644 $s12FBSDKCoreKit15_FeatureManagerC5check_15completionBlockySo12FBSDKFeatureV_ySbctFTo + 96 15 FBSDKCoreKit 0x00000001058ddd60 43-[FBSDKAppEvents fetchServerConfiguration:]_block_invoke_2 + 960 16 FBSDKCoreKit 0x000000010592e21c -[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:] + 1420 17 FBSDKCoreKit 0x00000001058dd980 __43-[FBSDKAppEvents fetchServerConfiguration:]_block_invoke + 128 18 FBSDKCoreKit 0x00000001058e27bc -[FBSDKAppEventsConfigurationManager _processResponse:error:] + 608 19 FBSDKCoreKit 0x000000010590dbbc -[FBSDKGraphRequestMetadata invokeCompletionHandlerForConnection:withResults:error:] + 152 20 FBSDKCoreKit 0x000000010590ab0c 82-[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:]_block_invoke + 144 21 FBSDKCoreKit 0x000000010590aa00 -[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:] + 700 22 FBSDKCoreKit 0x000000010590a5e0 __65-[FBSDKGraphRequestConnection _completeWithResults:networkError:]_block_invoke + 496 23 CoreFoundation 0x00000001ab7a9350 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 41808 24 CoreFoundation 0x00000001ab7c4680 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 153216 25 FBSDKCoreKit 0x000000010590a310 -[FBSDKGraphRequestConnection _completeWithResults:networkError:] + 548 26 FBSDKCoreKit 0x00000001059094a8 -[FBSDKGraphRequestConnection completeFBSDKURLSessionWithResponse:data:networkError:] + 800 27 libdispatch.dylib 0x0000000105e8453c _dispatch_call_block_and_release + 32 28 libdispatch.dylib 0x0000000105e85ff0 _dispatch_client_callout + 20 29 libdispatch.dylib 0x0000000105e96800 _dispatch_main_queue_drain + 1196 30 libdispatch.dylib 0x0000000105e96344 _dispatch_main_queue_callback_4CF + 44 31 CoreFoundation 0x00000001ab8396c8 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 632520 32 CoreFoundation 0x00000001ab81b02c 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 507948 33 CoreFoundation 0x00000001ab81feb0 CFRunLoopRunSpecific + 612 34 GraphicsServices 0x00000001e5a15368 GSEventRunModal + 164 35 UIKitCore 0x00000001add15668 CF21AD9C-EFBF-3961-A7C0-54BD30CEFEA9 + 3806824 36 UIKitCore 0x00000001add152cc UIApplicationMain + 340 37 MyApplication 0x0000000100678990 main + 96 38 dyld 0x00000001ca118960 4B042F28-0D14-30EC-A1DE-3DBB10866AD7 + 88416

To Reproduce

Not sure.

Expected Behavio

App normally run.

Environment

System: OS: macOS 13.2.1 CPU: (8) arm64 Apple M1 Memory: 93.28 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.2.0 - /opt/homebrew/bin/npm Watchman: 2022.10.17.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Android NDK: 22.1.7171670 IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 18.0.1.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.3 => 0.71.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

mikehardy commented 1 year ago

To Reproduce

Not sure.

🤔

What version of this package? What version of facebook-ios-sdk is pulled in, in Podfile.lock?

Typically this is a version mismatch, resulting in code dynamically trying to call ("sending a selector to an object" in objective-c terms) a method that it thinks exists but does not actually exist.

Why? No idea because

To Reproduce

Not sure.

NorbertSanpruch commented 1 year ago

@mikehardy I am getting the same error, can not reproduce it though. It's reported with sentry and happens rarely.

react-native: 0.68.2 react-native-fbsdk-next: 11.0.1,

FBSDKVersion is 15.0.0 (found in react-native-fbsdk-next.podspec).

Facebook SDK is initialized natively

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKCoreKit/FBSDKCoreKit-swift.h>

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  RCTAppSetupPrepareApp(application);
  [FBSDKApplicationDelegate.sharedInstance initializeSDK];

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

The app uses only setAdvertiserTrackingEnabled from the SDK

These are logs I get from sentry

libsystem_kernel    0x1bb54e618  __unlink
  libsystem_kernel    0x1bb552344  unlink
  libremovefile       0x1dc023894  __removefile_tree_walker
  libremovefile       0x1dc023bc4  removefile
  Foundation          0x1823b44b0  <redacted>
  Foundation          0x182356a8c  <redacted>
  Foundation          0x182366fcc  <redacted>
  Foundation          0x182363678  <redacted>
  FBSDKCoreKit_Basics 0x1056292c4  -[FBSDKCrashHandler clearCrashReportFiles] (FBSDKCoreKit_Basics/FBSDKCrashHandler.m:168)
  FBSDKCoreKit_Basics 0x105629824  -[FBSDKCrashHandler _getProcessedCrashLogs] (FBSDKCoreKit_Basics/FBSDKCrashHandler.m:216)
  FBSDKCoreKit_Basics 0x105628e84  __33-[FBSDKCrashHandler addObserver:]_block_invoke (FBSDKCoreKit_Basics/FBSDKCrashHandler.m:125)
  libdispatch         0x18095c094  <redacted>
  libdispatch         0x1808fdacc  <redacted>
  FBSDKCoreKit_Basics 0x105628e18  _dispatch_once (once.h:84)
  FBSDKCoreKit_Basics 0x105628e18  -[FBSDKCrashHandler addObserver:] (FBSDKCoreKit_Basics/FBSDKCrashHandler.m:123)
  FBSDKCoreKit        0x105d1893c  __32-[FBSDKInstrumentManager enable]_block_invoke (FBSDKCoreKit/Internal/Instrument/FBSDKInstrumentManager.m:61)
  FBSDKCoreKit        0x105d7c6e0  _FeatureManager.check (_FeatureManager.swift:56)
  FBSDKCoreKit        0x105d7c6e0  _FeatureManager.check (<compiler-generated>)
  FBSDKCoreKit        0x105d7b5c4  thunk for closure (<compiler-generated>)
  FBSDKCoreKit        0x105d0b4b4  +[FBSDKGateKeeperManager loadGateKeepers:] (FBSDKCoreKit/Internal/ServerConfiguration/FBSDKGateKeeperManager.m:117)
  FBSDKCoreKit        0x105d7b4dc  _FeatureManager.check (_FeatureManager.swift:55)
  FBSDKCoreKit        0x105d7b640  _FeatureManager.check (<compiler-generated>)
  FBSDKCoreKit        0x105d1886c  -[FBSDKInstrumentManager enable] (FBSDKCoreKit/Internal/Instrument/FBSDKInstrumentManager.m:59)
  FBSDKCoreKit        0x105d52e18  ApplicationDelegate.enableInstrumentation (ApplicationDelegate.swift:141)
  FBSDKCoreKit        0x105d52e54  thunk for closure (<compiler-generated>)
  FBSDKCoreKit        0x105d7c6e0  _FeatureManager.check (_FeatureManager.swift:56)
  FBSDKCoreKit        0x105d7c6e0  _FeatureManager.check (<compiler-generated>)
  FBSDKCoreKit        0x105d7b5c4  thunk for closure (<compiler-generated>)
  FBSDKCoreKit        0x105d0bf3c  +[FBSDKGateKeeperManager _didProcessGKFromNetwork:] (FBSDKCoreKit/Internal/ServerConfiguration/FBSDKGateKeeperManager.m:204)
  FBSDKCoreKit        0x105d0bdb4  +[FBSDKGateKeeperManager processLoadRequestResponse:error:] (FBSDKCoreKit/Internal/ServerConfiguration/FBSDKGateKeeperManager.m:195)
  FBSDKCoreKit        0x105d15bb8  -[FBSDKGraphRequestMetadata invokeCompletionHandlerForConnection:withResults:error:] (FBSDKCoreKit/Internal/Network/FBSDKGraphRequestMetadata.m:32)
  FBSDKCoreKit        0x105d12b08  __82-[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:]_block_invoke (FBSDKCoreKit/GraphAPI/FBSDKGraphRequestConnection.m:982)
  FBSDKCoreKit        0x105d129fc  -[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:] (FBSDKCoreKit/GraphAPI/FBSDKGraphRequestConnection.m:1016)
  FBSDKCoreKit        0x105d125dc  __65-[FBSDKGraphRequestConnection _completeWithResults:networkError:]_block_invoke (FBSDKCoreKit/GraphAPI/FBSDKGraphRequestConnection.m:965)
  CoreFoundation      0x180c160dc  <redacted>
  CoreFoundation      0x180c519e8  <redacted>
  FBSDKCoreKit        0x105d1230c  -[FBSDKGraphRequestConnection _completeWithResults:networkError:] (FBSDKCoreKit/GraphAPI/FBSDKGraphRequestConnection.m:943)
  FBSDKCoreKit        0x105d114a4  -[FBSDKGraphRequestConnection completeFBSDKURLSessionWithResponse:data:networkError:] (FBSDKCoreKit/GraphAPI/FBSDKGraphRequestConnection.m:798)
  libdispatch         0x18095b094  <redacted>
  libdispatch         0x18095c094  <redacted>
  libdispatch         0x180908d44  <redacted>
  libdispatch         0x180908994  <redacted>
  CoreFoundation      0x180c57034  <redacted>
  CoreFoundation      0x180c14538  <redacted>
  CoreFoundation      0x180c27194  CFRunLoopRunSpecific
  Foundation          0x182334eac  <redacted>
  Foundation          0x182373fd0  <redacted>
  myAppName                0x1050776a4  +[RNSplashScreen show] (node_modules/react-native-splash-screen/ios/RNSplashScreen.m:31)
  myAppName                0x1049b3c24  -[AppDelegate application:didFinishLaunchingWithOptions:] (myAppName/AppDelegate.mm:66)
  UIKitCore           0x18324d5c4  <redacted>
  UIKitCore           0x183421d98  <redacted>
  UIKitCore           0x18340b4bc  <redacted>
  UIKitCore           0x1832792d4  <redacted>
  UIKitCore           0x1830dfff8  _UIScenePerformActionsWithLifecycleActionMask
  UIKitCore           0x183202a2c  <redacted>
  UIKitCore           0x183318008  <redacted>
  UIKitCore           0x183540434  <redacted>
  UIKitCore           0x1834d0174  <redacted>
  UIKitCore           0x1830e0d44  <redacted>
  UIKitCore           0x18319c934  <redacted>
  UIKitCore           0x1830e2ad4  _UISceneSettingsDiffActionPerformChangesWithTransitionContext
  UIKitCore           0x1831c7184  <redacted>
  UIKitCore           0x18361cf38  <redacted>
  UIKitCore           0x18311077c  <redacted>
  UIKitCore           0x18315251c  <redacted>
  UIKitCore           0x18327dd3c  <redacted>
  UIKitCore           0x1831c55a0  <redacted>
  FrontBoardServices  0x191e20c50  <redacted>
  FrontBoardServices  0x191e42f98  <redacted>
  FrontBoardServices  0x191e03bdc  <redacted>
  FrontBoardServices  0x191e04fd4  <redacted>
  libdispatch         0x18095c094  <redacted>
  libdispatch         0x1808ff150  <redacted>
  FrontBoardServices  0x191e052ac  <redacted>
  FrontBoardServices  0x191e047c0  <redacted>
  FrontBoardServices  0x191e08960  <redacted>
  CoreFoundation      0x180cbc468  <redacted>
  CoreFoundation      0x180ccc598  <redacted>
  CoreFoundation      0x180c0e774  <redacted>
  CoreFoundation      0x180c13e48  <redacted>
  CoreFoundation      0x180c27194  CFRunLoopRunSpecific
  GraphicsServices    0x1a173a988  GSEventRunModal
  UIKitCore           0x183429a88  <redacted>
  UIKitCore           0x1831c2fc8  UIApplicationMain
  myAppName                0x1049b3ef4  main (myAppName/main.m:8)
mikehardy commented 1 year ago

can not reproduce it though

Directly implies that we cannot fix it unfortunately

JestemTrzcinska commented 1 year ago

https://stackoverflow.com/questions/75917100

Waffle133 commented 1 year ago

I had a similar error with FBAppEventsLogger

I ran native-clean-project but it didn't solve it.

I also removed #import <FBSDKCoreKit/FBSDKCoreKit.h> and only kept #import <FBSDKCoreKit/FBSDKCoreKit-swift.h>, but was not helpful

Then I realized that I had followed Step 1 of the [FBSDK Getting Started Guide] (https://developers.facebook.com/docs/ios/getting-started/) (react-native-fbsdk-next documentation states that only the 2, 3 and 4 steps must be followed).

After delete the FBSDK package dependency, the error went away.

I hope this can be helpful.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ricardo-alan commented 1 year ago

After delete the FBSDK package dependency, the error went away.

Amazing! This solved it, thanks.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

matanume commented 12 months ago

My error was changed after uninstall application on iPhone. I thought some development process may be the cause of problem.