解鎖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