我正在尝试在 Xcode 13.1 上运行我的项目,但问题是构建失败并显示消息:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening Ajman.xcworkspace. Run CLI with --verbose flag for more details.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace Ajman.xcworkspace -configuration Debug -scheme Ajman -destination id=6C41B609-DA05-4FAD-98F3-CC0264871189
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
note: Using new build system
note: Planning
Analyze workspace
Create build description
Build description signature: 1552deb311feffa24b258a2f780d63f1
Build description path: /Users/younisrahman/Library/Developer/Xcode/DerivedData/Ajman-gmdogtmpvnnzkcfzhirvzdbwaslh/Build/Intermediates.noindex/XCBuildData/1552deb311feffa24b258a2f780d63f1-desc.xcbuild
note: Build preparation complete
note: Building targets in parallel
CompileC /Users/younisrahman/Library/Developer/Xcode/DerivedData/Ajman-gmdogtmpvnnzkcfzhirvzdbwaslh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o /Volumes/Software/Projects/React-Native/Ajman/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'ReactCommon' from project 'Pods')
cd /Volumes/Software/Projects/React-Native/Ajman/ios/Pods
export LANG\=en_US.US-ASCII
.
.
.
.
.
The following build commands failed:
CompileC /Users/younisrahman/Library/Developer/Xcode/DerivedData/Ajman-gmdogtmpvnnzkcfzhirvzdbwaslh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o /Volumes/Software/Projects/React-Native/Ajman/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'ReactCommon' from project 'Pods')
(1 failure)
最佳答案
# Add this code bottom in Podfile
post_install do |installer|
#Fix after updating to Xcode 13.1
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
"RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
end
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
# If not work try this
change a parameter cast in the React module RCTTurboModuleManager.mm,
RCTBridgeModuleNameForClass(strongModule))
to
RCTBridgeModuleNameForClass(Class(strongModule)))
关于javascript - React Native 0.62.0 构建在 Xcode 13.1 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69994600/