3

I am using GitLab CI to automatically build an application for Android and iOS. My command line builds for iOS keeps failing with the error:

Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0'

I am using the master branch from cordova-ios GitHub. Since this has the following fix, like stated here: After upgrading to xcode 9, cordova app won't build, error 70, requires provisioning profile

In my build.json I use the following settings:

{
    "android": {
        "debug": {
            "keystore": "config/android.keystore",
            "storePassword": "<pass>",
            "alias": "debug",
            "password" : "<pass>",
            "keystoreType": ""
        },
        "release": {
            "keystore": "config/android.keystore",
            "storePassword": "<pass>",
            "alias": "release",
            "password" : "<pass>",
            "keystoreType": ""
        }
    },
    "ios": {
        "debug": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "<team id>",
            "packageType": "development",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ],
            "iCloudContainerEnvironment": "Development"
        },
        "release": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "<team id>",
            "packageType": "app-store",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ],
            "iCloudContainerEnvironment": "Production"
        }
    }
}

I do use the iCloudContainerEnvironment because I need push enabled. Als I start the build process using the correct provisioning profile. I do this with the CLI parameter, because I build the app for several different app IDS: cordova build ios --device --provisioningProfile=<uuid>

But no matter what I do or try it does not sign the app and keeps throwing the error.

EDIT:

Based on @Jerry Horton suggestion I added the provisioning profile into the build.json file. I tried it with the profile name and the profile UUID. Both situation throw the following error and no exportOptions.plist is to be found in the platforms/ios/ dir:

Code Signing Error: Provisioning profile "iOS Team Provisioning Profile: nl.XXX.loc.app" is Xcode managed, but signing settings require a manually managed profile.

I even removed all the plugins to be sure none of them stand in the way. So my build.json looks like this now:

{
    "android": {
        "debug": {
            "keystore": "config/android.keystore",
            "storePassword": "<pass>",
            "alias": "debug",
            "password" : "<pass>",
            "keystoreType": ""
        },
        "release": {
            "keystore": "config/android.keystore",
            "storePassword": "<pass>",
            "alias": "release",
            "password" : "<pass>",
            "keystoreType": ""
        }
    },
    "ios": {
        "debug": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "<team id>",
            "provisioningProfile": "<nl.XXX.loc.app or UUID>",
            "packageType": "development",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ],
            "iCloudContainerEnvironment": "Development"
        },
        "release": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "<team id>",
            "packageType": "app-store",
            "provisioningProfile": "<nl.XXX.app or UUID>",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ],
            "iCloudContainerEnvironment": "Production"
        }
    }
}

ExportOptions.plist:

When I manual open op XCode and create an archive/export for debug manually I do get an IPA and within this folder there is an ExportOptions.plist, like this:

<?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>compileBitcode</key>
    <false/>
    <key>method</key>
    <string>development</string>
    <key>provisioningProfiles</key>
    <dict>
            <key>nl.XXX.loc.app</key>
            <string>nl.XXX.loc.app</string>
    </dict>
    <key>signingCertificate</key>
    <string>iPhone Developer</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>TEAMID</string>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>

I really can't see what is wrong here. Maybe the thinning part?

1 Answer 1

1

You need to specify the provisioning profile in your build.json file in order for the exportOptions.plist file to be generated correctly during the Cordova build phase. Try it with one variation to see if it works, then you may want to keep variations of build.json for each application build variant. This is actually what I do in our projects. Our grunt build script copies build-.json to build.json prior to "cordova add platform", and "cordova build".

"provisioningProfile": "provisioning profile name or UUID"

After the Cordova build command is run, succeed or fail the exportOptions.plist is generated @

cordova/app/platforms/ios/exportOptions.plist

I found it helpful to review this as a debugging tool.

Sign up to request clarification or add additional context in comments.

9 Comments

still no luck, I edited the question with some output. Thanks for the time and help
If I execute the command ionic cordova build ios --debug instead of ionic cordova build ios --device the build does succeed. But then I do not get any IPA file or any exportOptions.plist file
Yes, the --device option builds the .ipa to be installed on the iPhone. Starting with Xcode 9, device builds require exportOptions.plist to contain a number of newly required fields. Unfortunately this file is created dynamically when running the "cordova build" command. If you populate the fields as described in stackoverflow.com/questions/46344443/… it will work everytime.
After reviewing your update, I believe the provisioning profile name you are using is incorrect. The profile are install in ~/Library/MobileDevice/Provisioning\ Profiles/
After reviewing your update, I believe the provisioning profile name you are using is incorrect. The profiles are installed in the ~/Library/MobileDevice/Provisioning\ Profiles/ directory after you install them. Also notice the names are <UUID>.mobileprovision. It easy to re-download the profile from developer.apple.com, open in an editor, then search for UUID. Also, the name is the better option, and is the name of this file as downloaded vs after installed in ~/Library/MobileDevice/Provisioning\ Profiles/. You can also open either file in a text editor and search for name and/or UUID.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.