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

iOS App Extensions - Release build error #5520

Open
jessorlisa opened this issue Apr 26, 2021 · 5 comments
Open

iOS App Extensions - Release build error #5520

jessorlisa opened this issue Apr 26, 2021 · 5 comments
Labels

Comments

@jessorlisa
Copy link

jessorlisa commented Apr 26, 2021

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!

@jessorlisa
Copy link
Author

From the lack of responses I have to assume this is no longer or never has been fully supported? Any feedback would be welcomed. Thank you.

@rigor789
Copy link
Member

I don't think it was ever "fully-supported" however, I believe you should be able to build it from within XCode by preparing the project after ns clean.

  1. ns clean
  2. ns prepare ios --for-device --env.report --env.hiddenSourceMap --release
  3. Open platforms/iOS/<projectname>.xcworkspace in XCode
  4. Set up the signing options
  5. Archive & push to TestFlight/AppStore

@jessorlisa
Copy link
Author

@rigor789 Thanks for your feedback. That confirms my assumption 😞.

Yes, it is working via Xcode itself, but sadly this is not a viable option for ci build processes…

@rigor789
Copy link
Member

@jessorlisa If you enable --log trace and look at the commands the CLI spawns, you can probably do them on CI as well using xcodebuild and then passing the right flags/certificates for the extensions build, while doing the regular build normally with the CLI.

@saschaarthur
Copy link

I was looking into this problem as well. I was able to build the projectmap with xcodedebug (without the share extension).

After beeing successful with this step, the share extension was added to the NS project.

Preparing the project with
npm ci prepare
Creates the xcode-projectmap with both (extension + mobile-app) - which is completly fine and works out for debug builds (because they can both be signed with the dev-certificate, which is somehow a wildcard)

But sadly Apple requires that the extension and the mobile app is signed with different certificates.

Thats where im currently failing.

Selecting the different certificates in xcode "manually" works out perfectly. Afterwards its possible to build the whole projectmap with the xcodedbuild cli.

But sadly its not possible (or i didnt found a way) to modify with cli commands only "one project" - the share extension, inside of the project map, to change its default certificate to the "share extension" certificate.

Still wondering how this ever was working...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants