NativeScript / NativeScript/nativescript-cli

Distribution build for watch target fails

オープン
#5,291 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug os: ios
主要言語
JavaScript
スター
1.1k
フォーク
204
平均マージ
1日 9時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、--provision オプションを使用して、watch 拡張機能を含む NativeScript プロジェクトの Distribution ビルドを再現します。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 を短くまとめたダイジェスト。