React-native-fbsdk: Duplicate case values on run ios

Created on 7 Apr 2019  路  17Comments  路  Source: facebook/react-native-fbsdk

馃悰 Bug Report

This started coming up recently. I have reset back many hashes to try and get back to a working state however this seems to come up all of the time now.

When running npm run ios the build fails on both command line and in XCode on RCTFBSDKLoginManager.m with the following errors:

  switch (loginBehavior) {
    case FBSDKLoginBehaviorBrowser:
      result = @"browser"; 
      break;
    case FBSDKLoginBehaviorNative: // Duplicate case value: 'FBSDKLoginBehaviorBrowser' and 'FBSDKLoginBehaviorNative' both equal '0'
      result = @"native";
      break;
    case FBSDKLoginBehaviorSystemAccount: // Duplicate case value: 'FBSDKLoginBehaviorNative' and 'FBSDKLoginBehaviorSystemAccount' both equal '0'
      result = @"system-account";
      break;
    case FBSDKLoginBehaviorWeb: // Duplicate case value: 'FBSDKLoginBehaviorSystemAccount' and 'FBSDKLoginBehaviorWeb' both equal '0'
      result = @"web";
      break;

To Reproduce

npm run ios

NOTE: Removing the problematic case statements allows build to run successfully

Expected Behavior

Expect build to complete successfully.

Code Example

Environment

System:
      OS: macOS 10.14
      CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
      Memory: 46.17 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 9.3.0 - ~/.nvm/versions/node/v9.3.0/bin/node
      npm: 6.7.0 - ~/.nvm/versions/node/v9.3.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 22, 23, 24, 25, 26, 27
        Build Tools: 23.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.1, 27.0.3
        System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4697961
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0
      react-native: 0.57.0 => 0.57.0
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-ui-lib: 3.17.3
      react-native: 0.58.3

Most helpful comment

Use react-native-fbsdk 0.8.0 and FBSDK 4.42.0 works for me

"react-native-fbsdk": "^0.8.0"

pod 'FBSDKCoreKit', '~> 4.42.0'
pod 'FBSDKLoginKit', '~> 4.42.0'
pod 'FBSDKShareKit', '~> 4.42.0'

All 17 comments

Same problem after reinstalling node modules..

Same problem with yarn & cocoapods too.

In the ios sdk 5.0.0, the FBSDKLoginBehavior enum is changed, now it has only one possibile value (FBSDKLoginBehaviorBrowser=0).
https://developers.facebook.com/docs/reference/iossdk/5.0.0-rc.1/FBSDKLoginKit/enums/fbsdkloginbehavior.html/

If you are using cocoapods, you can use the previous sdk version:

pod 'FBSDKCoreKit', '~> 4.39.1' pod 'FBSDKLoginKit', '~> 4.39.1' pod 'FBSDKShareKit', '~> 4.39.1'

(Tested and working)

Use react-native-fbsdk 0.8.0 and FBSDK 4.42.0 works for me

"react-native-fbsdk": "^0.8.0"

pod 'FBSDKCoreKit', '~> 4.42.0'
pod 'FBSDKLoginKit', '~> 4.42.0'
pod 'FBSDKShareKit', '~> 4.42.0'

@cark1 solution worked for me

Latest version 4.44.0 seems to have some issue, fallback to 4.42.0 for now.

Using version 4.42.0 works for me

Running into the same issues with the latest version. Downgrading to per @cark1 's suggestion seems like it fixes it.

4.42.0 didn't work for me, was throwing a 'FBSDKCoreKit/FBSDKAppEvents.h' file not found error. 4.39.1 seems to work

@thanhcuong1990 is right, it does work. But it's not the best solution. It's becoming a bit of an annoyance to follow all the exceptions in my react native projects (which, usually is android).

Is there anything we can do to help?

@thanhcuong1990
getting this error - Use of undeclared identifier 'FBSDKSystemAccountStoreAdapter'
after I used -
pod 'FBSDKCoreKit', '~> 4.42.0'

pod 'FBSDKLoginKit', '~> 4.42.0'

pod 'FBSDKShareKit', '~> 4.42.0'

After many tries, i have fix using theses versions:

pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'FBSDKCoreKit', '~> 4.42.0'
pod 'FBSDKLoginKit', '~> 4.42.0'
pod 'FBSDKShareKit', '~> 4.42.0'

I upgraded from 4.38.0 to 4.42.0 and I can confirm that is working.
I my pod file I have the same details as @hugohenrique (thanks for sharing)

Initially, I had the same error as @vlad-fylp .'FBSDKCoreKit/FBSDKAppEvents.h' file not found
After removing libRCTFBSDK.a from Link Binary With Libraries and recompile the project, everything star working again.

neither helped

I upgraded from 4.38.0 to 4.42.0 and I can confirm that is working.
I my pod file I have the same details as @hugohenrique (thanks for sharing)

Initially, I had the same error as @vlad-fylp .'FBSDKCoreKit/FBSDKAppEvents.h' file not found
After removing libRCTFBSDK.a from Link Binary With Libraries and recompile the project, everything star working again.

nor

After many tries, i have fix using theses versions:

pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'FBSDKCoreKit', '~> 4.42.0'
pod 'FBSDKLoginKit', '~> 4.42.0'
pod 'FBSDKShareKit', '~> 4.42.0'

Finally I had to downgrade to

  pod 'FBSDKCoreKit', '~> 4.40.0'
  pod 'FBSDKLoginKit', '~> 4.40.0'
  pod 'FBSDKShareKit', '~> 4.40.0'

and both ios and android work smoothly

Don't they test before releasing, everyone suggesting downgrading, I just re-downloaded my pods and it messed up. Really DISAPPOINTING :(

I hope this is not required anymore for latest RN and react-native-fbsdk?

Fixed by #541

Was this page helpful?
0 / 5 - 0 ratings