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

Viewed 4628

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 Answers

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.

Related