NativeScript / NativeScript/nativescript-cli

iOS App Extensions - Release build error

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

還沒有人認領這個 Issue。

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

描述

Environment

  • CLI: ├── nativescript@7.2.1
  • Cross-platform modules: @nativescript/core@7.3.0
  • Android Runtime: -
  • iOS Runtime: ├── @nativescript/ios@6.5.4 (JSC)
  • XCode Version: Xcode 12.4 (12D4e)
  • Plugin(s):
    ├── @nativescript/angular@11.2.0
    ├── @nativescript/webpack@4.1.0

Describe the bug
We set up a Share extension following the instructions here, it is working as intended and the development build is working fine as well.

{N}7 documentation: iOS App Extensions
(The GitHub version of the documentation page can be found here.)


But the release build fails with the error/warning message:

error: Provisioning profile "myApp" has app ID "com.myapp.mobile", which does not match the bundle ID "com.myapp.mobile.share". (in target 'share' from project 'myappcommobile')
warning: Provisioning profile "myApp" for "myappcommobile" contains entitlements that aren't in the entitlements file: com.apple.developer.associated-appclip-app-identifiers. To use these entitlements, add them to your entitlements file. Otherwise, remove unused entitlements from your provisioning profile. (in target 'myappcommobile' from project 'myappcommobile')

The relevant release build steps are:

(1) Prepare the provisioning profile of the main app (myApp):

mac-003:mobile user$ rm "/Users/user/Library/MobileDevice/Provisioning Profiles/"*
mac-003:mobile user$ uuid=`grep UUID -A1 -a myApp.mobileprovision | grep -io "[-A-F0-9]\{36\}"`
mac-003:mobile user$ cp myApp.mobileprovision "/Users/user/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
mac-003:mobile user$ ns prepare ios --provision $uuid


Preparing project...

[...]

Project successfully prepared (ios)

(2) Prepare the provisioning profile of the share extension (myApp_Share):

mac-003:mobile user$ uuid2=`grep UUID -A1 -a myApp_Share.mobileprovision | grep -io "[-A-F0-9]\{36\}"`
mac-003:mobile user$ cp myApp_Share.mobileprovision "/Users/user/Library/MobileDevice/Provisioning Profiles/$uuid2.mobileprovision"
mac-003:mobile user$ ns prepare ios --provision $uuid2

Preparing project...

[...]

Project successfully prepared (ios)

(3) Run the release build

mac-003:mobile user$ ns build ios --clean --for-device --env.report --env.hiddenSourceMap --certificate keychain.p12 --certificatePassword myPassword --release --provision $uuid

Preparing project...

[...]

Building project...
Xcode build...
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: Provisioning profile "myApp" has app ID "com.myapp.mobile", which does not match the bundle ID "com.myapp.mobile.share". (in target 'share' from project 'myappcommobile')

[... removed unrelated warnings for readability ...]

** ARCHIVE FAILED **

Command xcodebuild failed with exit code 65

To Reproduce

  • Set up a Share extension as explained here.
  • Run a release build

Expected behavior
The release build succeeds the same the development build does.

Additional context
It seems the CLI does not recognize all profiles as eligible:

mac-003:mobile user$ ns prepare ios --provision
Searching for devices...
┌──────────────────────────────────────────┬────────────┬──────────────┬─────────┐
│ Provision Name / Provision UUID / App Id │ Team       │ Type / Due   │ Devices │
│                                          │            │              │         │
│ 'myApp'                                  │ myTeam     │ Distribution │         │
│ <uuid>                                   │ (<teamid>) │ 5 Mar 2022   │         │
│ <teamid>.com.myapp.mobile                │            │              │         │
└──────────────────────────────────────────┴────────────┴──────────────┴─────────┘

There are also 1 non-eligable provisioning profiles.

Please let me know if there is anything else you need to assist us on this. Thanks!

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

從 iOS App Extensions 文件開始,使用 ns prepare ios --provision,接著使用 ns build ios --clean --for-device --release --provision 重現失敗。追蹤 CLI 如何為主應用程式和 share 擴充功能選取 provisioning profile;當文件所述的 Share 擴充功能 release 建置能使用相符的 profile 成功完成時,即表示完成。

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

評估

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

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

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