realm / realm-dart

Realm is a mobile database: a replacement for SQLite & ORMs.
Apache License 2.0
763 stars 87 forks source link

Flutter Build Issue MacOS - Invalid Code Signing Entitlements (while uploading to Testflight) #1679

Closed flawnn closed 4 months ago

flawnn commented 5 months ago

What happened?

Same issue as in https://github.com/realm/realm-dart/issues/1151:

@whaleHan Can you tell me how you solved it - your issue seems closed!

And besides that obviously, let me know if anyone knows a fix for this

What happened? After building the macos application and uploading it to the Apple App Store, Apple sends an email.

TMS-90288: Invalid Code Signing Entitlements - The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. According to the provisioning profile, the bundle contains a key value that is not allowed: '' for the key 'com.apple.application-identifier' in '***.app/Contents/Frameworks/realm.framework/Versions/A/Resources/librealm_dart.dylib'

ITMS-90286: Invalid Code Signing Entitlements - Your application bundle's signature contains code signing entitlements that are not supported on macOS. Specifically, value '' for key 'com.apple.application-identifier' in '***.app/Contents/Frameworks/realm.framework/Versions/A/Resources/librealm_dart.dylib' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier .

Repro steps 1、Upload realm to 1.0.0 from 0.9.0+rc 2、Xcode building MacOS Application and uploading TestFight。 3、After uploading success, Apple sends an email:

Dear Developer,

We identified one or more issues with a recent delivery for your app, "NowDO:日程计划&番茄钟&日历&提醒&时间管理&读书学习" 1.2.0 (35). Please correct the following issues, then upload again.

ITMS-90288: Invalid Code Signing Entitlements - The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. According to the provisioning profile, the bundle contains a key value that is not allowed: '' for the key 'com.apple.application-identifier' in 'NowDO.app/Contents/Frameworks/realm.framework/Versions/A/Resources/librealm_dart.dylib'

ITMS-90286: Invalid Code Signing Entitlements - Your application bundle's signature contains code signing entitlements that are not supported on macOS. Specifically, value '' for key 'com.apple.application-identifier' in 'NowDO.app/Contents/Frameworks/realm.framework/Versions/A/Resources/librealm_dart.dylib' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier .

Repro steps

Build on CodeMagic in CI/CD Environment - then upload to TestFlight

Version

3.19.3

What Atlas Services are you using?

Atlas Device Sync

What type of application is this?

Flutter Application

Client OS and version

2.2.1

Code snippets

No response

Stacktrace of the exception/crash you're getting

No response

Relevant log output

No response

sync-by-unito[bot] commented 5 months ago

➤ PM Bot commented:

Jira ticket: RDART-1031

whaleHan commented 5 months ago

This problem appeared in realm version 1.0.0, was fixed in version 1.2.0, but resurfaced in version 2.2.1

whaleHan commented 5 months ago

You can either downgrade the realm version or wait for the author to fix it

nielsenko commented 5 months ago

The previous fix was to build librealm-dart.dylib with xcode 14.0.1.

We upgraded to use xcode 15.3 in 2.2.1, because Apple has since made it a requirement to use xcode 15 for apps published to the app store.

However, this is not currently a requirement for libraries, so I have downgraded to using xcode 14.0.1 for now.

flawnn commented 4 months ago

Hmmm, interesting. I used the new 2.3.0 version to build on CodeMagic again to upload. I got the same problem.

Here an excerpt of the mail I get from Apple:

image

I really have no idea anymore why that happens - Can I do something to help you investigate that? Cheers!

flawnn commented 4 months ago

@nielsenko tagging you here, because not sure you get a notification!

nielsenko commented 4 months ago

@flawnn Can you confirm that it works for you if you downgrade to 2.1.0?

flawnn commented 4 months ago

@flawnn Can you confirm that it works for you if you downgrade to 2.1.0?

Yes, 2.1.0 works for me fine!

nielsenko commented 4 months ago

@flawnn Thanks. It appears that xcode 14.3.1 is too new as well, I really need to go back to 14.0.1 (as I said I would 🙄).

However, this is untenable in the long run, so I will give it a bit more thought.

flawnn commented 4 months ago

@flawnn Thanks. It appears that xcode 14.3.1 is too new as well, I really need to go back to 14.0.1 (as I said I would 🙄).

However, this is untenable in the long run, so I will give it a bit more thought.

Maybe there is a way to dynamically create the shared library? We can pass an application-identifier property over the pubspec maybe, or it might be even inferrable through other platform-specific files, or?

flawnn commented 4 months ago

I did try to build a new version with the latest version of realm_dart (including RDART-1031) but it still fails due to the same entitlement issue.

Is there still something coming regarding this issue or do I/you need to rebuild the binary for this to work again?

nirinchev commented 4 months ago

How did you test that out? #1694 hasn't been released yet.

flawnn commented 4 months ago

How did you test that out? #1694 hasn't been released yet.

I checked out realm_dart as a git package and then tried to build :)

nielsenko commented 4 months ago

@flawnn Unfortunately that won't work in this case, as the change is in how we build the native library, and when using a git dep you are still downloading the previous native lib.

flawnn commented 4 months ago

@flawnn Unfortunately that won't work in this case, as the change is in how we build the native library, and when using a git dep you are still downloading the previous native lib.

Alright, I see. I'll just wait then for the next release 👍