How do I produce an iOS Release Build that my client can sign on their end?

前端 未结 10 719
你的背包
你的背包 2020-12-12 09:17

My scenario

I wrote an iOS app for a client. The project is almost over and now it\'s time for them to put it in the App Store. I\'ve been sending t

10条回答
  •  Happy的楠姐
    2020-12-12 10:01

    I believe I have found a way to do exactly what you want, I haven't done extensive testing or tried to upload to the app store but from the testing I have done it seems to be good. The resign and the addition of my provisioning profile is working as I can install it on my devices defined in the AdHoc profile with no manual profile installation needed. Second test was I got an iPad and an iPhone version of an app with the same bundle ID from xCode, at first I could not have both in iTunes but after the resign and bundle ID change I was able to have both installed. I also tried changing the app name and that worked as well, it showed on the device and in iTunes with the new name. Below is my script, it's designed to resign a specific app for me, so the profile and bundleID are hardcoded. I flip between an iPhone and iPad version of the app so I added that as a parameter to the script. But you should be able to take the principles I have here and refine them for yourself.

    The guts of this builds upon articles like Further adventures in resigning for iOS from Dan's Dev Diary and very similar to Erica Sadun's App Signer listed above. The main addition I made was the editing of the Info.plist prior to resigning.

    #!/bin/sh
    
    DestFile="Signed_$1"
    SigningCertName="YOUR DISTROBUTION CERT NAME HERE FROM KEYCHAIN"
    AppInternalName="APP NAME FROM INSIDE PAYLOAD FOLDER.app"
    
    echo
    echo "Going to take the app $1 and resign it as $DestFile"
    echo
    
    if [ "$2" = "iphone" ] ; then
            echo "Using iPhone Profile"
            echo
            BundleID="com.YOURCOMPANY"
            ProvProfile="/Users/YOURNAME/Library/MobileDevice/Provisioning Profiles/PROVISIONINGPROFILE.mobileprovision"
    elif [ "$2" = "ipad" ] ; then
            echo "Using iPad Profile"
            echo
            BundleID="com.YOURCOMPANY.ipad"
            ProvProfile="/Users/YOURNAME/Library/MobileDevice/Provisioning Profiles/PROVISIONINGPROFILE_iPad.mobileprovision"
    else
            echo "You must enter either iphone or ipad as the second parameter to choose the profile to sign with."
            echo
            exit 1
    fi
    
    rm -f Resigned.ipa
    unzip -q $1 -d temparea
    cd temparea/Payload
    echo "*** Original Signing ***"
    echo "************************"
    codesign -d -vv $AppInternalName/
    cp "$ProvProfile" ./$AppInternalName/embedded.mobileprovision
    export EMBEDDED_PROFILE_NAME=embedded.mobileprovision
    export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    
    #Update the Info.plist with the new Bundle ID
    sed 's/>ORIGINAL BUNDLEID HERE'$BundleID'./$AppInternalName/Info.plist.new
    mv -f ./$AppInternalName/Info.plist.new ./$AppInternalName/Info.plist
    
    # this will do a rename of the app if needed
    # sed 's/>ORIGINAL APP NAMENEW APP NAME./$AppInternalName/Info.plist.new
    # mv -f ./$AppInternalName/Info.plist.new ./$AppInternalName/Info.plist
    
    # echo "Hit enter to proceed with signing."
    # read TMP
    codesign -f -vv -s "$SigningCertName" -i $BundleID $AppInternalName
    
    echo
    echo "*** New Signing ***"
    echo "*******************"
    codesign -d -vv $AppInternalName/
    cd ..
    zip -r -q ../Resigned.zip .
    cd ..
    rm -R temparea
    mv Resigned.zip $DestFile
    echo
    echo "New IPA Created, $DestFile"
    

提交回复
热议问题