安装react-native-twitter-signin后React Native iOS编译崩溃求助
解决React Native iOS模拟器编译TwitterSignin链接错误问题
编译报错信息:
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/beykan/Desktop/react-native-new/AwesomeProject/ios/Pods/TwitterCore/iOS/TwitterCore.framework/TwitterCore' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 2024-05-05 16:55:40.905 xcodebuild[36861:207688] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:iOS Simulator, id:2F6E33CB-8741-4DC5-A82D-C74E417125DD, OS:14.5, name:iPhone 8 } { platform:iOS Simulator, id:2F6E33CB-8741-4DC5-A82D-C74E417125DD, OS:14.5, name:iPhone 8 } ** BUILD FAILED ** The following build commands failed: Ld /Users/beykan/Library/Developer/Xcode/DerivedData/AwesomeProject-dfrwbqswilehisegtuyhoamhwida/Build/Products/Debug-iphonesimulator/AwesomeProject.app/AwesomeProject normal (in target 'AwesomeProject' from project 'AwesomeProject') (1 failure)
解决方案
方案1:调整Xcode架构排除设置
- 打开iOS项目的
.xcworkspace文件 - 选中项目根节点,在TARGETS列表里选择你的主应用目标
- 切换到Build Settings标签,搜索
Excluded Architectures - 在Debug配置下,为iOS Simulator添加
arm64到排除架构列表 - 展开Pods项目,给所有包含Twitter的Pod目标(如TwitterCore、TwitterKit)的Debug配置,也添加
arm64到iOS Simulator的Excluded Architectures
方案2:通过Podfile批量配置
- 打开ios目录下的
Podfile,在文件末尾添加以下代码:
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.name == 'Debug' && ['TwitterCore', 'TwitterKit'].include?(target.name) config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' end end end end
- 执行命令重新安装依赖:
cd ios && pod install && cd ..
方案3:清理缓存后重新编译
- 执行以下命令清理编译缓存:
rm -rf ios/build rm -rf ~/Library/Developer/Xcode/DerivedData
- 重启Xcode,重新编译项目
内容的提问来源于stack exchange,提问作者alper yolcu
相关产品推荐
相关产品推荐

