Search code examples
xcodeshellenterpriseipaadhoc

creating IPA for enterprise app and not an ad hoc


i'm trying to create a script for an ipa file for my app, but i want it to be for enterprise distribution and not an Ad Hoc.

my script is:

# creating xcArchive file

xcodebuild -workspace <ProjectName>.xcworkspace -scheme <SchemeName> archive \
-archivePath <DirectoryPath><ScemeName>.xcarchive


# compressing the xcArchive file into IPA file
xcodebuild \
-exportArchive \
-exportFormat ipa \
-archivePath <DirectoryPath>/<ScemeName>.xcarchive \
-exportPath <DirectoryPath>/<ScemeName>.ipa" \
        -exportProvisioningProfile "<My Distribution Provisioning Profile>".

Now, in apple wizard, when i'm creating an IPA file, in its embedded.mobileprovision i can see those attributes: for eneterprise distribution:

 <key>ProvisionsAllDevices</key>
 <true/>

for Ad-Hoc distribution:

<key>ProvisionedDevices</key>
    <array>
        <string>accacaca0-9800ac898a908908c90aca890c8a90</string>
        <string>123123123123123123bfd123bdf123fv123bdf12</string>
.
.
.
    </array>

In my case, i don't know why, i don't have any of them, and therefore cannot install them on any device. anyone can tell me why is it ? please ?


Solution

  • I solved it. I should use a modern approach, and write it in export.plist:

    #
    # creating .xcarchive file from .app file
    function create_archive_file() {
        xcodebuild \
        -workspace ${PROJECT_NAME}.xcworkspace \
        -scheme "${scheme_name}" \
        archive \
        -archivePath ${SRCROOT}/${proj_external_name}/${1}.xcarchive
    }
    #
    # compressing xcArchive file into IPA file
    function create_ipa_from_archive() {
        xcrun xcodebuild \
        -exportArchive \
        -archivePath ${SRCROOT}/${proj_external_name}/${scheme_name}.xcarchive \
        -exportPath ${SRCROOT}/${proj_external_name}/folder \
        -exportOptionsPlist export.plist
    }
    

    and in export.plist:

    <?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>teamID</key>
        <string>... (my TeamID, get it from one archiving action only once, and check it's details in build editor)</string>
        <key>method</key>
        <string>enterprise</string>
        <key>uploadSymbols</key>
        <true/>
    </dict>
    </plist>