从git上把项目拉下来后,想要跑起来,这个过程中的填坑记录。
1、在ios目录下执行pod install
报错:
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.
You can try adding it manually in `/Users/yangdejian/.cocoapods/repos` or via `pod repo add`.
其实就是国内下载太慢了,因为文件很多又大(差不多700多M)。然后切换源到清华:https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs
下载了一丢丢,又卡住了,然后报:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
还是太慢了,直接连接超时了。
算了,只能想办法加快网速,同事帮忙搞了个V*2*r*a*y(https://github.com/yanue/V*2*r*a*y*U/releases)(MAC版本)(把“*”去掉,敏感词没办法)
2、pod install下载完了后,报了个组件错误
[!] CocoaPods could not find compatible versions for pod "GDTMobSDK": In Podfile: GDTMobSDK (~> 4.11.8) None of your spec sources contain a spec satisfying the dependency: `GDTMobSDK (~> 4.11.8)`. You have either: * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile
不知道为啥报版本不对,搞了半天,还是同事帮忙解决的(可能是远程仓库的该分支删除了),拉不下来代码,改项目中的podfile,把这个插件的版本号改成仓库中有的,再pod install即可。
查看插件版本命令:pod search GDTMobSDK(第一次比较慢,要构建索引)
3、尝试在xcode中导出ipda包
配置了apple证书后,在xcode中build项目,又报了一个SDK的错误:
看到pod里面也有KSDrawAd-sdk这些文件。还是同事帮忙解决的,选择模拟器为:Any iOS Device(xcode默认选中的那个可能不支持这个SDK导致的)
然后又报了RN的jsbundle文件不存在的错,这个好解决了。
生成命令:
1 react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ./release_ios/main.jsbundle --assets-dest ./release_ios
导出ipa时又报了错,应该是plist不对(从其他项目拷过来改的):
error: exportArchive: No profiles for 'com.xxx.xxx' were found Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.xxx.xxx' were found" UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=No profiles for 'com.xxx.xxx' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.xxx.xxx'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.} ** EXPORT FAILED **
没办法,只能通过xcode先导一个ipa包出来(包里面有exportOptions.plist的文件),打开看了下,确实好几个地方不对:
最后关于provisioningProfiles的属性,发现用命令打包时,只是配置了两个属性和对应的profile文件名(不用加mobileprovision后缀),也就是说打包时,不用从appstore下载这个profile文件,还是因为我在xcode中打包过一次(那时候选过一次),就不需要再指定文件路径了??(请懂的朋友指点迷津!!)