NativeScript / NativeScript/nativescript-cli

Distribution build for watch target fails

未關閉
#5,291 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug os: ios
主要語言
JavaScript
星號
1.1k
分支
204
平均合併
1 天 9 小時
30 天內合併 PR
8

描述

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 Runtime: 6.4.2

Describe the bug

I 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.
I 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.

But once I try to run the distribution build by providing the distribution profile via the --provision option I get the following error:

error: Provisioning profile "Generic Profile for Internal Deployment" doesn't include signing certificate "Apple Development: John Doe (XXXXX)". (in target 'watchapp Extension' from project '...')

So 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:
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";

This 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
"CODE_SIGN_IDENTITY" = "iPhone Distribution";
fixes the problem.

I assume the fix could be done simply by checking for the target in here:
pbxproj-dom

Unfortunately 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.
This is done by passing an exportOptions.plist file to xcodebuild.

This 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 provides only the profile for the iOS target. And therefore the archive export fails with the follwoing error:

Error 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.}

Adding the following lines in export-options-plist-service.ts fixes the issue
<key>${projectData.projectIdentifiers.ios}.watchkitapp</key> <string>${provision}</string> <key>${projectData.projectIdentifiers.ios}.watchkitapp.watchkitextension</key> <string>${provision}</string>

To Reproduce
Run Nativescript project with watch extension and provide distribution profile via the --provision option

Expected behavior
ipa should be successfully created and signed

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,使用 --provision 選項重現一個含有 watch 擴充功能的 NativeScript 專案之發佈建置。閱讀 lib/services/ios/export-options-plist-service.ts 並檢查產生的 project.pbxproj,然後檢視所參照的 pbxproj-dom 目標處理。完成標準是 iOS 應用程式、watch 應用程式和 watch 擴充功能使用必要的簽署設定檔,並成功建立已簽署的 IPA。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
ios, javascript
領域
build-system, cli, mobile-dev
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。