Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25652] iOS: Ad-hoc build fails when packaging with WatchApp #9722

Merged
merged 4 commits into from Jan 22, 2018

Conversation

feons
Copy link
Contributor

@feons feons commented Jan 11, 2018

JIRA: https://jira.appcelerator.org/browse/TIMOB-25652

Specify the provisioning profile to use for each executable in the app, including WatchKit App and WatchKit Extension.

@build
Copy link
Contributor

build commented Jan 11, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

@@ -228,6 +228,18 @@ exports.init = function (logger, config, cli) {
exportsOptions.provisioningProfiles = {};
exportsOptions.provisioningProfiles[builder.tiapp.id] = pp.uuid;

builder.extensions.forEach(function (ext) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, but this code does not work. It always uses the app's provisioning profile uuid because item.ppUUIDs does not have a property called target. Second, you code does not work for iOS Extensions because it checks the target name to see if it matches "WatchKit App" or "WatchKit Extension". Furthermore, those names are arbitrary and could be changed.

You need to look up each target's bundle identifier by walking the native targets and their build configurations. If it helps, here's the code:

builder.extensions.forEach(function (ext) {
	const nativeTargets = ext.objs.PBXNativeTarget;
	ext.targets.forEach(function (extTarget) {
		if (extTarget.ppUUIDs[target]) {
			const targetUUID = Object.keys(nativeTargets).filter(uuid => typeof nativeTargets[uuid] === 'object' && nativeTargets[uuid].name.replace(/^"/, '').replace(/"$/, '') === extTarget.name)[0];
			const buildConf = targetUUID && ext.objs.XCConfigurationList[nativeTargets[targetUUID].buildConfigurationList].buildConfigurations.filter(c => c.comment === 'Release');
			const confUUID = buildConf && buildConf.length && buildConf[0].value;
			const id = confUUID && ext.objs.XCBuildConfiguration[confUUID].buildSettings.PRODUCT_BUNDLE_IDENTIFIER;
			if (id) {
				exportsOptions.provisioningProfiles[id] = extTarget.ppUUIDs[target];
			}
		}
	});
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cb1kenobi, updated. Thanks!

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

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

Being as the code is mine, I approve it. However it would be nice if someone else can test it before merging.

@ewieberappc ewieberappc merged commit 42cb4ae into tidev:master Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants