ios - 错误 : typedef redefinition with different types ('NSInteger' (aka 'long' ) vs 'enum ACAccountCredentialRenewResult' )

标签 ios react-native react-native-fbsdk

我尝试将 react-native-fbsdk 安装到我的 React Native 应用程序,并按照库的 README.MDGetting Started with Facebook SDK 指南中提到的说明进行操作。

我在路径后遇到了一些错误,所以我没有使用重定向到 node_modules 下的库的 pod 'react-native-fbsdk',而是删除了它并添加了

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

现在我收到以下导致构建失败的错误。无法找出问题所在。

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

完全错误:

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: 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

最佳答案

作为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.

提出的解决方案是

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'

使用那些没有中断拉取请求的依赖项的旧版本。

关于ios - 错误 : typedef redefinition with different types ('NSInteger' (aka 'long' ) vs 'enum ACAccountCredentialRenewResult' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56175064/

相关文章:

React-native fbsdk 构建错误

c++ - OpenCV 断言矩阵乘法失败

React-Native Camera 没有在 android 中打开

javascript - React Native - 按下按钮时更新状态

react-native-fbsdk - 无法为 fbsdk 下载文件 ios_setup.js

ios - 未找到 react-native-fbsdk FBSDKCoreKit 和 FBSDKShareKit

javascript - 如何在 iPhone 上使用 onclick

ios - 仅使用 NSUbiquitousKeyValueStore 时,如何以编程方式检测用户设备上是否启用了 iCloud?

ios - viewWithTag 可以使用有限的时间

javascript - map 内匿名函数内的方法未定义