Help us understand the problem. What is going on with this article?

ipaファイルのProvisioningを差し替える

More than 5 years have passed since last update.
プロビジョニングを入れ替える
#!/bin/bash

#元のipaファイル
IPA_FILE=test.ipa

#出力するipaファイル
DEST_FILE=test_copy.ipa

#差し替えるProvisioning Profile
PROV_FILE=test.mobileprovision

#差し替えるEntitlements
ENTITLEMENTS=Entitlements.plist

#差し替える署名の証明書の名前
SIGN="iPhone Developer: DEVELOPER NAME (XXXXXXXXXX)"

mkdir -p tmp
cp ${IPA_FILE} tmp
cd tmp
unzip -q ${IPA_FILE}
APP_FILE=Payload/`ls Payload`

#署名を削除
rm -r ${APP_FILE}/_CodeSignature

#プロビジョニングファイルを新しいものに置き換え
cp ../${PROV_FILE} ${APP_FILE}/embedded.mobileprovision

#.appに署名し直す
codesign --force --sign "${SIGN}"\
    --resource-rules ${APP_FILE}'/ResourceRules.plist' ${APP_FILE}

# #.appを署名し直す(entitlementsも書き換える)
# codesign --force --sign "${SIGN}"\
#   --resource-rules ${APP_FILE}'/ResourceRules.plist'\
#   --entitlements ../${ENTITLEMENTS} ${APP_FILE}

#署名が上手くいったか確認
codesign -d --entitlements - ${APP_FILE}

# #再パッケージ(使う時は、次のzip圧縮はいらない。失敗するかも・・・)
# /usr/bin/xcrun -sdk iphoneos PackageApplication\
#   -v ${APP_FILE} -o ${DEST_FILE} --sign "${SIGN}" --embed ../${PROV_FILE}

#zip圧縮で新しいipaファイル作成
zip -qr ${DEST_FILE} Payload
cp -f ${DEST_FILE} ../
cd ../
rm -rf tmp
キーチェーンに登録された証明書の一覧を出力する
security find-identity -p codesigning -v
Entitlements.plistサンプル
<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!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>XXXXXXXXXX.*</string> 
        <key>keychain-access-groups</key> 
        <array> 
            <string>XXXXXXXXXX.*</string> 
        </array> 
        <key>get-task-allow</key> 
        <true/> 
    </dict> 
</plist> 

参考

iOSアプリの署名を付け替える - Qiita [キータ]
http://qiita.com/beakmark/items/33c0b73603e491f08a33

iOS アプリのprovisioning profile差し替え方法 | Septeni Engineers' Blog | セプテーニ エンジニアブログ
http://labs.septeni.co.jp/?p=815

doesNotRecognizeBlog, codesign(1) についてのメモ
http://mtakagi.tumblr.com/cli/codesign.1/

seyself
bascule
DATA × TECHNOLOGY × DESIGN
http://www.bascule.co.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした