目前遇到一个需求:给定一个ipa包,需要修改包里面的plist文件,在重新签名打包。
http://www.modelmetrics.com/tomgersic/codesign-re-signing-an-ipa-between-apple-accounts/
https://gist.github.com/2878446
http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload/
https://github.com/maciekish/iReSign
http://stackoverflow.com/questions/6569120/resigning-an-application-outside-xcode
2013.1.15[done] 【python版】
#1 解压 cmd = "unzip -q %s" %(IN_FILE) loginfo(cmd) os.system(cmd) #2 删除_CodeSignature cmd = "rm -rf Payload/xxx.app/_CodeSignature" loginfo(cmd) os.system(cmd) #3 替换mobileprovision cmd = "cp %s Payload/xxx.app/embedded.mobileprovision" %(PROVISION) loginfo(cmd) os.system(cmd) #4 签名 cmd = "%s -f -s \"xxxx\" --resource-rules \"Payload/xxx.app/ResourceRules.plist\" Payload/xxx.app" %(CODESIGN) loginfo(cmd) os.system(cmd) # 压缩 cmd = "zip -rqm %s Payload" %(OUT_FILE) loginfo(cmd) os.system(cmd) loginfo('success')
PS:
1.apktool解压apk
call tools\apktool d -f %APK% %TEMP%
2.sed.exe修改AndroidManifest.xml
call tools\sed -i -e /XXX/d %TEMP%/AndroidManifest.xml -e "/\/application/i\<meta-data android:name=\"XXX\" android:value=\"%XXX%\"/>" "%TEMP%/AndroidManifest.xml"
3.apktool压缩apk
call tools\apktool b %TEMP% %TEMP_APK%
4.jarsigner签名
call tools\jarsigner\jarsigner -verbose -keystore key\%KEY_NAME% -storepass %KEY_PASSWORD% -signedjar unaligned.apk %TEMP_APK% %KEY_ALIAS% > NUL
5.zipalign对齐
call tools\zipalign -v 4 unaligned.apk out.apk > NUL