Title: Distribution build for watch target fails · Issue #5291 · NativeScript/nativescript-cli · GitHub
Open Graph Title: Distribution build for watch target fails · Issue #5291 · NativeScript/nativescript-cli
X Title: Distribution build for watch target fails · Issue #5291 · NativeScript/nativescript-cli
Description: Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 6.4.1 Cross-platform modules: 6.4.2 iOS Run...
Open Graph Description: Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 6.4...
X Description: Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 6.4...
Opengraph URL: https://github.com/NativeScript/nativescript-cli/issues/5291
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Distribution build for watch target fails","articleBody":"**Environment**\r\nProvide version numbers for the following components (information can be retrieved by running `tns info` in your project folder or by inspecting the `package.json` of the project):\r\n - CLI: 6.4.1\r\n - Cross-platform modules: 6.4.2\r\n - iOS Runtime: 6.4.2\r\n\r\n**Describe the bug**\r\n\u003c!-- A clear and concise description of what the bug is. Please, explain whether it's a build time error or a runtime error. More detailed logs can be easily obtained by following the instructions in this guide: https://docs.nativescript.org/get-support#how-to-obtain-diagnostic-reports. --\u003e\r\nI have added a watch project to my Nativescript project by following the instructions from here #4589 . I can successfully run `tns prepare ios` and the watch project is included in the xcode project afterwards. \r\nI am using manual code signing to sign the iOS app as well as the watchOS app. Which both works perfectly fine as long as I do a development build. \r\n\r\nBut once I try to run the distribution build by providing the distribution profile via the `--provision` option I get the following error:\r\n\r\nerror: Provisioning profile \"Generic Profile for Internal Deployment\" doesn't include signing certificate \"Apple Development: John Doe (XXXXX)\". (in target 'watchapp Extension' from project '...')\r\n\r\nSo it looks like Provisioning Profile is updated but the wrong signing certificate is used. So looking into the autogenerated project.pbxproj reveals the following build setting for the watchapp and watchextension:\r\n`\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Distribution\";`\r\n\r\nThis will apply the code settings only to iOS SDK targets. And hence the signing certificates for the watch project don't get updated. Changing the build setting for the watch targets to \r\n`\"CODE_SIGN_IDENTITY\" = \"iPhone Distribution\";`\r\nfixes the problem. \r\n\r\nI assume the fix could be done simply by checking for the target in here:\r\n[pbxproj-dom](https://github.com/NativeScript/pbxproj-dom/blob/master/xcode.ts#L182)\r\n\r\nUnfortunately the code signing still fails for the distribution build after this fix. The `--provision` option makes sure that the correct provisioning profile is used when exporting the archive and building the ipa. \r\nThis is done by passing an exportOptions.plist file to xcodebuild. \r\n\r\nThis file is autogenerated by Nativescript during the tns build and it needs to state the correct provisioning profile for each target. But unfortunately the [export-options-plist-service.ts](https://github.com/NativeScript/nativescript-cli/blob/master/lib/services/ios/export-options-plist-service.ts#L66) provides only the profile for the iOS target. And therefore the archive export fails with the follwoing error:\r\n\r\nError Domain=IDEProvisioningErrorDomain Code=9 \"\"watchapp.app\" requires a provisioning profile.\" UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=\"watchapp.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}\r\n\r\nAdding the following lines in export-options-plist-service.ts fixes the issue \r\n``\u003ckey\u003e${projectData.projectIdentifiers.ios}.watchkitapp\u003c/key\u003e\r\n \u003cstring\u003e${provision}\u003c/string\u003e\r\n \u003ckey\u003e${projectData.projectIdentifiers.ios}.watchkitapp.watchkitextension\u003c/key\u003e\r\n \u003cstring\u003e${provision}\u003c/string\u003e``\r\n\r\n\r\n\r\n**To Reproduce**\r\nRun Nativescript project with watch extension and provide distribution profile via the `--provision` option\r\n\r\n**Expected behavior**\r\nipa should be successfully created and signed \r\n\r\n","author":{"url":"https://github.com/siewedu","@type":"Person","name":"siewedu"},"datePublished":"2020-04-06T15:00:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/5291/nativescript-cli/issues/5291"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a18517b2-a9f2-e807-912f-123b8dd9c385 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A95C:1B78C0:5EEC9:7D173:696B5A70 |
| html-safe-nonce | 35b1d70050ef5d6522ff77c0ab20dcf2cd5e7ab7862a5d9189d7d71af4caae73 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTVDOjFCNzhDMDo1RUVDOTo3RDE3Mzo2OTZCNUE3MCIsInZpc2l0b3JfaWQiOiI3Nzc3MDAxMTA2ODgwMjg5MzkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bd4160c64457eaa028336ba8074cc53efa8e993544cd2c7ca08daad63c35dd45 |
| hovercard-subject-tag | issue:595190033 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/nativescript-cli/5291/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e51d40b40d022a45bd1e74c4eb4f541871ccab22b55bd09074cc8fd2b26ca49f/NativeScript/nativescript-cli/issues/5291 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e51d40b40d022a45bd1e74c4eb4f541871ccab22b55bd09074cc8fd2b26ca49f/NativeScript/nativescript-cli/issues/5291 |
| og:image:alt | Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 6.4... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | siewedu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/nativescript-cli git https://github.com/NativeScript/nativescript-cli.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 21347346 |
| octolytics-dimension-repository_nwo | NativeScript/nativescript-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21347346 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/nativescript-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width