Search code examples
iosreact-nativereact-native-fbsdk

error: typedef redefinition with different types ('NSInteger' (aka 'long') vs 'enum ACAccountCredentialRenewResult')


I tried to install react-native-fbsdk to my React Native app and followed the instructions as mentioned in the library's README.MD and Getting Started with Facebook SDK guide.

I was getting some errors following the path so instead of using pod 'react-native-fbsdk' that redirects to library under node_modules, I removed it and added

  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'
  pod 'FBSDKShareKit'

Now I'm getting the following error that's causing my build to fail. Was unable to find out what the issue is.

error: typedef redefinition with different types ('NSInteger' (aka 'long') vs 'enum ACAccountCredentialRenewResult')

FULL ERROR:

CompileC /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/Objects-normal/x86_64/_FBSDKLoginRecoveryAttempter.o FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/_FBSDKLoginRecoveryAttempter.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/admin/MyApp/ios/Pods
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/admin/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/admin/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DCOCOAPODS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=8.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -fobjc-abi-version=2 -fobjc-legacy-dispatch -index-store-path /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Index/DataStore -iquote /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/FBSDKLoginKit-generated-files.hmap -I/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/FBSDKLoginKit-own-target-headers.hmap -I/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/FBSDKLoginKit-all-non-framework-target-headers.hmap -ivfsoverlay /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/all-product-headers.yaml -iquote /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/FBSDKLoginKit-project-headers.hmap -I/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Products/Debug-iphonesimulator/FBSDKLoginKit/include -I/Users/admin/MyApp/ios/Pods/Headers/Private -I/Users/admin/MyApp/ios/Pods/Headers/Private/FBSDKLoginKit -I/Users/admin/MyApp/ios/Pods/Headers/Public -I/Users/admin/MyApp/ios/Pods/Headers/Public/Bolts -I/Users/admin/MyApp/ios/Pods/Headers/Public/FBSDKCoreKit -I/Users/admin/MyApp/ios/Pods/Headers/Public/FBSDKLoginKit -I/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/DerivedSources/x86_64 -I/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/DerivedSources -F/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Products/Debug-iphonesimulator/FBSDKLoginKit -include /Users/admin/MyApp/ios/Pods/Target\ Support\ Files/FBSDKLoginKit/FBSDKLoginKit-prefix.pch -MMD -MT dependencies -MF /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/Objects-normal/x86_64/_FBSDKLoginRecoveryAttempter.d --serialize-diagnostics /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/Objects-normal/x86_64/_FBSDKLoginRecoveryAttempter.dia -c /Users/admin/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/_FBSDKLoginRecoveryAttempter.m -o /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-drouqzftczwubqdkbisqdreewdmi/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/Objects-normal/x86_64/_FBSDKLoginRecoveryAttempter.o

In file included from /Users/admin/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/_FBSDKLoginRecoveryAttempter.m:21:
In file included from /Users/admin/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginKit+Internal.h:19:
In file included from /Users/admin/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit.h:27:
In file included from /Users/admin/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h:23:
/Users/admin/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h:23:19: error: typedef redefinition with different types ('NSInteger' (aka 'long') vs 'enum ACAccountCredentialRenewResult')
typedef NSInteger ACAccountCredentialRenewResult;
                  ^
In module 'Accounts' imported from /Users/admin/MyApp/ios/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKSystemAccountStoreAdapter.h:19:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h:11:28: note: previous definition is here
typedef NS_ENUM(NSInteger, ACAccountCredentialRenewResult) {
                           ^
1 error generated.

Environment

Environment: OS: macOS 10.14 Node: 12.1.0 Yarn: 1.16.0 npm: 6.9.0 Watchman: 4.9.0 Xcode: Xcode 10.1 Build version 10B61 Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.53.3 => 0.53.3


Solution

  • as explained on github bug report

    The Podspec for this repo uses the newest version it can find of FBSDKLoginKit.

    This dependency changed to deprecate all of the LoginBehavior enum values aside from Browser in the past day.

    The solution proposed is

    For the moment you can put a working version in podfile for this. Until react-native-fbsdk is fixed.

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

    Use older versions of those dependencies which do not have the breaking pull request.