实践使用shell脚本一键打包并导出ipa

1,354 阅读1分钟

Github:

xcode_shell

问题

  • 项目中使用pod管理三方库,如果使用了user_framework!会报错,如下:
error: Pods-DuduiOS does not support provisioning profiles. Pods-DuduiOS does not support provisioning profiles, but provisioning profile XX-AdHoc has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-DuduiOS' from project 'Pods')

原因:The issue is that the newest version of Cocoapods is trying to sign the frameworks.

  • 打包成功,但是导出失败,报错如下:
error: exportArchive: AFNetworking.framework does not support provisioning profiles.

Error Domain=IDEProvisioningErrorDomain Code=10 "AFNetworking.framework does not support provisioning profiles." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=AFNetworking.framework does not support provisioning profiles., NSLocalizedRecoverySuggestion=AFNetworking.framework does not support provisioning profiles, but provisioning profile ZG-AdHoc has been manually specified. Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.}

原因:这是 Podfile 文件中使用了 use_frameworks!造成的坑,这是因为使用了 use_frameworks! 后,CocoaPods 要对每一个 Framework 进行证书签名,而每个 Framework 的 bundleID 都是不一样的;

  • Showing All Messages Could not find or use auto-linked library 'swiftDarwin' ...

原因:React-Native project after adding a Swift Pods library;

解决:

1.File -> New -> File

2.Select Swift File

3.Confirm Create Bridging Header

参考

stackoverflow.com/questions/5…

  • install_plugin/install_plugin-Swift.h' file not found

原因:因为取消了framwork的方式,所以通过命名空间install_plugin是找不到install_plugin-Swift.h的;

解决:

//#import <install_plugin/install_plugin-Swift.h>
替换
#import <install_plugin-Swift.h>

题外话

此外还可以使用 fastlane 自动化构建工具来实现打包,将 Fastlane 的自动化工作流与蒲公英插件结合起来可以实现一键打包应用并上传到蒲公英分发平台,具体过程可以查看蒲公英的官方文档:使用 Fastlane 上传 App 到蒲公英