'OneSignalServiceExtension failing when submitting to App Store

I have added OneSignal as a Swift Package and set it up as it says on their website. Now when I build and submit to the App Store it comes back with these errors:

[!] Error uploading ipa file: 
 [Transporter Error Output]: ERROR ITMS-90685: CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.onesignal.OneSignal-Dynamic' under the iOS application 'MyApp.app'.
[Transporter Error Output]: ERROR ITMS-90205: Invalid Bundle. The bundle at 'MyApp.app/PlugIns/OneSignalNotificationServiceExtension.appex' contains disallowed nested bundles.
[Transporter Error Output]: ERROR ITMS-90206: Invalid Bundle. The bundle at 'MyApp.app/PlugIns/OneSignalNotificationServiceExtension.appex' contains disallowed file 'Frameworks'.
[Transporter Error Output]: Return status of iTunes Transporter was 1: ERROR ITMS-90685: CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.onesignal.OneSignal-Dynamic' under the iOS applicati\nERROR ITMS-90205: Invalid Bundle. The bundle at 'MyApp.app/PlugIns/OneSignalNoti\nERROR ITMS-90206: Invalid Bundle. The bundle at 'MyApp.app/PlugIns/OneSignalNotificationServiceExtension.appex' contains disallowed file 'Frameworks'.
[Transporter Error Output]: The call to the iTMSTransporter completed with a non-zero exit status: 1. This indicates a failure.

I've doubled checked that Always embed Swift standard libraries is set to No in the extension target, as so many answers on here say. It's set to Yes on the main app target. My run path for the extension says:

$(inherited)
@executable_path/Frameworks
@executable_path/../../Frameworks 

How can I fix this?

UPDATE

It turns out that OneSignal is added as a Framework to the extension. However, because it was added via Swift Package Manager, it doesn't seem to be possible to not embed it! Anyone know a fix for that?



Solution 1:[1]

I suspect the root of the issue is

ERROR ITMS-90685: CFBundleIdentifier Collision. There is more than one > bundle with the CFBundleIdentifier value 'com.onesignal.OneSignal-Dynamic' under the iOS application 'MyApp.app'.

You can't use bundle identifiers of com.onesignal.*.

  1. Verify that your Bundle Identifier does not contain com.onesignal.* or the string, onesignal.

Taget ->> General ->> Bundle Identifier

The next three errors are likely caused by misconfiguring the notification service extension. The one error of note,

Return status of iTunes Transporter was 1: ERROR ITMS-90685: CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.onesignal.OneSignal-Dynamic' under the iOS applicati\nERROR ITMS-90205: Invalid Bundle. The bundle at 'MyApp.app/PlugIns/OneSignalNoti\nERROR ITMS-90206: Invalid Bundle. The bundle at 'MyApp.app/PlugIns/OneSignalNotificationServiceExtension.appex' contains disallowed file 'Frameworks'.

Indicates that the notification service extension's bundle identifier is com.onesignal.*.

  1. Verify that OneSignalNotificationServiceExtension is of the form your.unique.identifier.OneSignalNotificationServiceExtension where unique doesn't equal onesignal.

a.b.c.OneSignalNotificationServiceExtension

Another detail about OneSignalNotificationServiceExtension is that the version must match the version of your app exactly. If there is a mismatch, copy the version from your app and use that as the notification service extension's version.

At the moment, I don't think Swift has anything to do with your errors. If my assumptions (numbered above) turn out to be false, this may be a more significant issue that warrants a new issue on GitHub.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 iAmWillShepherd