解锁Mac OS
password = "12345"
userName = "jimmy"
/usr/bin/security unlock-keychain -p $password /Users/$userName/Library/Keychains/login.keychain
设置包名版本号
cd ${WORKSPACE}
buildPlist=${WORKSPACE}/Info.plist
bundleId="com.bundleid"
CFBundleVersion=0.0.0
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" $buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $bundleId" $buildPlist
指定project clean
xcodebuild clean \
-project Unity-iPhone.xcodeproj \
-scheme Unity-iPhone \
-configuration Release
打Archive包
#指定证书,bundle id打包
xcodebuild -archivePath $location \
-project Unity-iPhone.xcodeproj \
-configuration Release \
-scheme Unity-iPhone \
archive \
-sdk iphoneos \
-arch arm64 \
PROVISIONING_PROFILE_SPECIFIER="your_provisiont_profile" \
PRODUCT_BUNDLE_IDENTIFIER="your.bundle.id" \
DEVELOPMENT_TEAM="AXXXXXX4"
No matching provisioning profiles found
明明证书在xcode上配置成功,xcodebuild的时候却显示无法找到证书:
error: No profile for team 'asdfasdfasdf' matching 'dev_com_sdf.mobileprovision' found: Xcode couldn't find any provisioning profiles matching 'asdfasdfasdf/dev_com_sdf.mobileprovision'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'ttt' from project 'ttt')
** ARCHIVE FAILED **
我的打包命令:
xcodebuild archive -project /Users/kingsoft/Desktop/ttt/ttt.xcodeproj \
-scheme ttt \
-configuration Debug \
-archivePath .\
CODE_SIGN_IDENTITY="iPhone Developer: xxx (xxx)" \
PROVISIONING_PROFILE_SPECIFIER=dev_com_sdf.mobileprovision. \
DEVELOPMENT_TEAM="asdfasdfasdf" \
PRODUCT_BUNDLE_IDENTIFIER="com.asdf.asdf"
解决方案是:
CODE_SIGN_IDENTITY不能放到自定义参数的第一位。
xcodebuild archive -project /Users/kingsoft/Desktop/ttt/ttt.xcodeproj \
-scheme ttt \
-configuration Debug \
-archivePath .\
PROVISIONING_PROFILE_SPECIFIER=dev_com_sdf.mobileprovision. \
DEVELOPMENT_TEAM="asdfasdfasdf" \
CODE_SIGN_IDENTITY="iPhone Developer: xxx (xxx)" \
PRODUCT_BUNDLE_IDENTIFIER="com.asdf.asdf"
UnityFramework 因为CodeSigned引起的问题:
因为在Unity 2019.3.x往后,Unity修改了打包策略,会在xcode导出的工程里面多出一个UnityFramework target,而且是auto signed,这样就会导致两个问题:
1.无法导出iPa
2.签名后的iPa有可能企业证书无法安装
解决方式,cd到Unity-iPhone.xcodeproj下
sed -i '' 's/CODE_SIGN_STYLE = Automatic;/ CODE_SIGN_STYLE = Manual;/' project.pbxproj
手动吧unityframework设为手动签名
打出ipa
xcodebuild -exportArchive \
-archivePath $your_archive_path \
-exportPath ./ \
-exportOptionsPlist $your_export_plsit.plist PROVISIONING_PROFILE=$your_profile
网友评论