Last active
May 5, 2019 12:22
-
-
Save demonnico/8017146 to your computer and use it in GitHub Desktop.
resign ipa file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#First of all, create a new plist file named 'channnel.plist' and refer into your project. | |
#Second, move codes below in 'didFinishLaunchingWithOptions' | |
#NSString * channelPath = [[NSBundle mainBundle] pathForResource:@"channel" ofType:@"plist"]; | |
#NSDictionary*channelDic= [NSDictionary dictionaryWithContentsOfFile:channelPath]; | |
#NSString * channelIdentify = [channelDic objectForKey:@"channel"]; | |
#[MobClick startWithAppkey:UMENG_KEY reportPolicy:BATCH channelId:channelIdentify]; | |
#last step, 'cd' into the folder where xxx.ipa is there. | |
#generally, it's the name of scheme | |
appName="xiaonimei" | |
#you can find it in system keychains, or xcode build setting. | |
certificate="iPhone Developer" | |
#the channels which you'll distribute to. | |
channel[0]="91helper" | |
channel[1]="pphelper" | |
channel[2]="tongbutui" | |
channel[3]="kuaiyong" | |
channel[4]="pphelper" | |
channel[5]="weiphone" | |
for((i=0;i<5;i++)) | |
do | |
# unzip the IPA | |
unzip $appName.ipa | |
# delete old signature | |
rm -rf Payload/${appName}.app/_CodeSignature/ | |
channelIdentify=${channel[$i]} | |
/usr/libexec/PlistBuddy -c "Set :channel $channelIdentify" Payload/${appName}.app/channel.plist | |
# copy new provisioning profile into the App | |
#cp ~/Downloads/embedded.mobileprovision Payload/xiaonimei.app/embedded.mobileprovision | |
# sign the App | |
codesign -f -s $certificate --resource-rules Payload/${appName}.app/ResourceRules.plist Payload/${appName}.app | |
# zip the contents into a new IPA file | |
zip -qr ${appName}_${channel[$i]}.ipa Payload/ | |
# remove Payload group | |
rm -rf Payload/ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment