Skip to content

Commit

Permalink
CB-13315: (ios) fixed bug building for ios using Xcode 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Horton authored and surajpindoria committed Sep 27, 2017
1 parent 7ab0315 commit cf424b4
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion bin/templates/scripts/cordova/lib/build.js
Expand Up @@ -26,6 +26,7 @@ var plist = require('plist');
var util = require('util');

var check_reqs = require('./check_reqs');
var projectFile = require('./projectFile');

var events = require('cordova-common').events;

Expand Down Expand Up @@ -96,7 +97,7 @@ module.exports.run = function (buildOpts) {
var buildType = buildOpts.release ? 'release' : 'debug';
var config = buildConfig.ios[buildType];
if (config) {
['codeSignIdentity', 'codeSignResourceRules', 'provisioningProfile', 'developmentTeam', 'packageType', 'buildFlag'].forEach(
['codeSignIdentity', 'codeSignResourceRules', 'provisioningProfile', 'developmentTeam', 'packageType', 'buildFlag', 'iCloudContainerEnvironment'].forEach(
function (key) {
buildOpts[key] = buildOpts[key] || config[key];
});
Expand Down Expand Up @@ -179,16 +180,35 @@ module.exports.run = function (buildOpts) {
return;
}

var locations = {
root: projectPath,
pbxproj: path.join(projectPath, projectName + '.xcodeproj', 'project.pbxproj')
};

var bundleIdentifier = projectFile.parse(locations).getPackageName();
var exportOptions = {'compileBitcode': false, 'method': 'development'};

if (buildOpts.packageType) {
exportOptions.method = buildOpts.packageType;
}

if (buildOpts.iCloudContainerEnvironment) {
exportOptions.iCloudContainerEnvironment = buildOpts.iCloudContainerEnvironment;
}

if (buildOpts.developmentTeam) {
exportOptions.teamID = buildOpts.developmentTeam;
}

if (buildOpts.provisioningProfile && bundleIdentifier) {
exportOptions.provisioningProfiles = { [ bundleIdentifier ]: String(buildOpts.provisioningProfile) };
exportOptions.signingStyle = 'manual';
}

if (buildOpts.codeSignIdentity) {
exportOptions.signingCertificate = buildOpts.codeSignIdentity;
}

var exportOptionsPlist = plist.build(exportOptions);
var exportOptionsPath = path.join(projectPath, 'exportOptions.plist');

Expand Down

6 comments on commit cf424b4

@bayssmekanique
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a possibility of getting a minor version release for these fixes?

@mark-veenstra
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor release would be appreciated since CI pipelines are broken due to this.

@surajpindoria
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bayssmekanique & @mark-veenstra,

There are currently some other issues that we need to get fixed before the next minor release. Even without those, the Apache release process would require a minimum of 3 days before we could release. In the meantime you could use a workaround by updating the ios engine tag within your projects config.xml to use github instead of npm.

<engine name="ios" spec="https://github.com/apache/cordova-ios.git" />

@fransyozef
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this fixed/pushed to master? I've just updated cordova-ios to 4.5.2, but still when try to build, I still get

Error Domain=IDEProvisioningErrorDomain Code=9 ""MyApp.app" requires a provisioning profile with the
Push Notifications feature." UserInfo={NSLocalizedDescription="MyApp.app" requires a provisioning
profile with the Push Notifications feature., NSLocalizedRecoverySuggestion=Add a profile to the
"provisioningProfiles" dictionary in your Export Options property list.}

I use Xcode9. I've already changed my provisioning profiles in my workspace (checked out Auto manage signing).

And yes, I first removed the ios platform.

@mark-veenstra
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fransyozef Check if you have the iCloudContainerEnvironment item added to your build.json file, because this option enables the Push Notification signing. For example this is my build.json:

{
    "ios": {
        "debug": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "TEAMID",
            "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": "TEAMID",
            "packageType": "app-store",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ],
            "iCloudContainerEnvironment": "Production"
        }
    }
}

@fransyozef
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I already got it to work now ;)

#338 (comment)

Please sign in to comment.