IPA 重签名 发表于 2016-12-13 | 分类于 开发那些事 , iOS | 重签名步骤12345678910111213141516171819202122// 1. 解压unzip -q Example.ipa// 2. 删除旧签名rm -rf Payload/Example.app/_CodeSignature// 3. Info.plist/usr/libexec/PlistBuddy -c "Set CFBundleIdentifier ${NEW_BUNDLE_ID}" Playload/Example.app/Info.plist/usr/libexec/PlistBuddy -c "Set CFBundleName ${NEW_APP_NAME}" Payload/Example.app/Info.pilst// 如果需要还需copy 新的 embeded.mobileprovision// 4. 强制重签名// 因为证书有空格,所以证书那里必须用双引号括起来codesign -f -s "${CERTIFICATE}" --identifier ${NEW_BUNDLE_ID} --entitlements ${ENTITLEMENTS} Playload/Example.app// 查看签名是否正确codesign -vv -d Payload/Example.app// 5. 打包 ipazip -qr new.ipa Playload// 清理rm -rf Payload entitlements 可以改 entitlements.template 涉及到的命令12345678910111213141516171819// 查看本机证书security find-identity -v -p codesigning// 重签名codesign -f -s ${CERTIFICATE_NAME} --identifier ${Bundle_ID} --entitlements Example.entitlements Payload/Example.app// 查看签名codesign -vv -d Example.app// 验证签名codesign --verify Example.ap// 查看/修改 Plistplutil -p Info.plistPlistBuddy -c "Set CFBundleIdentifer ${BUNDLE_ID}" Info.plist// 解压 / 压缩unzip -q xxx.appzip -qr xxx.ipa Payload 备注测试证书 12Certificate: iPhone Developer: h s (5LW76GJTQE)APP_ID_PREFIX: Q4JEMYK62P entitlements 模板 123456789101112<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict> <key>application-identifier</key> <string>${APP_ID_PREFIX}.${BUNDLE_ID}</string> <key>com.apple.developer.team-identifier</key> <string>${APP_ID_PREFIX}</string> <key>get-task-allow</key> <true/></dict></plist> 参考:iOS批量自动打包和部署(Ⅱ):自动打包iOS批量自动打包和部署(Ⅲ):重新签名和自动部署