赞
踩
puyarn先安装依赖, 进入到ios文件中, pod install 安装ios的依赖, 退出ios,yarn ios运行项目
yarn && cd ios && pod install && cd .. && yarn ios
yarn ios运行比较慢 耐心等待 结果报错或者正常运行
删除依赖包括两部分 node-module和ios文件中 Podfile.lock文件
重新运行
2.1 react-native-video 报错
运行 react-native unlink react-native-video
2.2 pod install 报错
pod install --repo-update 多次尝试直到成功
(移动开发知识)pod install LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60_什么课程值得买
2.3 ios打包上架后 yarn ios运行报错
The following build commands failed:
CpResource /Users/zhangfuqiang/Desktop/app/mingshigongpei/release_ios/main.jsbundle /Users/zhangfuqiang/Library/Developer/Xcode/DerivedData/msgp-aytniufprlayvpdioxbnqjesqglt/Build/Products/Debug-iphonesimulator/msgp.app/main.jsbundle
CpResource /Users/zhangfuqiang/Desktop/app/mingshigongpei/release_ios/assets /Users/zhangfuqiang/Library/Developer/Xcode/DerivedData/msgp-aytniufprlayvpdioxbnqjesqglt/Build/Products/Debug-iphonesimulator/msgp.app/assets
原因:ios文件下project.pbxproj 寻找release_ios找不到 release_ios是ios上架需要生成的文件
解决办法 手动创建release_ios 执行打包命令 react-native bundle --entry-file index.js --bundle-output release_ios/main.jsbundle --assets-dest release_ios/
打包完成后 yarn ios运行成功
2.4 模拟机启动报错 No bundle URL present
解决方法 add this on info.plist:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSAllowsLocalNetworking</key> <true/> </dict>
参考链接
ios - What is the meaning of 'No bundle URL present' in react-native? - Stack Overflow
2.5 报错error code 65
info Found Xcode workspace "msgp.xcworkspace" `instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement) info Building (using "xcodebuild -workspace msgp.xcworkspace -configuration Debug -scheme msgp -destination id=2c3b267709714d0a8d664b33d1ede1d59ac14aff") (node:20534) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) 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 msgp.xcworkspace. Run CLI with --verbose flag for more details. Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace msgp.xcworkspace -configuration Debug -scheme msgp -destination id=2c3b267709714d0a8d664b33d1ede1d59ac14aff User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES note: Using new build system note: Building targets in parallel note: Planning build note: Analyzing workspace note: Constructing build description note: Build preparation complete /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNSound' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'react-native-orientation-locker' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNThumbnail' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'BVLinearGradient' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'react-native-nodemediaclient' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'react-native-video' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNFS' from project 'Pods') error: Signing certificate is invalid. Signing certificate "Apple Development: Ruiyun Zhang (596C8ABNQ7)", serial number "<DVTSigningCertificateSerialNumber: 0x7fde6a06f960>", is not valid for code signing. It may have been revoked or expired. (in target 'msgp' from project 'msgp') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'boost-for-react-native' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'TZImagePickerController' from project 'Pods') /Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNSyanImagePicker' from project 'Pods') ** BUILD FAILED **
解决办法
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' end end end
2.6报错 react-native-fetch-blob
worked for me thanks, run grep -rl "s.dependency 'React/Core'" node_modules/ | xargs sed -i '' 's=React/Core=React-Core=g' and run pod update
https://github.com/joltup/rn-fetch-blob/pull/397
2.7 react-native-image-picker 报错
2.8签名报错
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 msgp.xcworkspace. Run CLI with --verbose flag for more details. Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace msgp.xcworkspace -configuration Debug -scheme msgp -destination id=2c3b267709714d0a8d664b33d1ede1d59ac14aff User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES note: Using new build system note: Building targets in parallel note: Planning build note: Analyzing workspace note: Constructing build description note: Build preparation complete error: Signing certificate is invalid. Signing certificate "Apple Development: Ruiyun Zhang (596C8ABNQ7)", serial number "<DVTSigningCertificateSerialNumber: 0x7f96e55c52a0>", is not valid for code signing. It may have been revoked or expired. (in target 'msgp' from project 'msgp')
2.9 trunk下载失败
Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`. You can try adding it manually in `/Users/zhangfuqiang/.cocoapods/repos` or via `pod repo add`.
解决办法:podfile文件中增加
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
获取uiud
公司手机 iPhone7Plus:
uiud2c3b267709714d0a8d664b33d1ede1d59ac14aff
真机调试
// 1、通过“设备名称”运行 react-native run-ios --device "iPhone的名字" // 2、通过“udid”运行 react-native run-ios --udid "iPhone的udid"
【React Native 学习】mac 采用模拟器、真机调试 - 简书
npm install -g ios-deploy报错
解决方法
sudo chown -R $USER /usr/local/lib/node_modules
输入开机密码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。