onesignal-expo-plugin
onesignal-expo-plugin copied to clipboard
[Bug]: Build fails with "The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and "")" after updating xcode to 15.2
After updating Xcode to version 15.2, my ios app build fails with this error.
The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and ""); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
I think I found the issue and also a possible solution, but I have no real experience with xcode, so please doublecheck it.
When adding the OneSignal PBXGroup to the Toplevel Group, this code makes the assumption, that the top level group is the only group without a name: https://github.com/OneSignal/onesignal-expo-plugin/blob/d1e9927e9015ec5b2c7c5807d84e1a9c1abb7d47/onesignal/withOneSignalIos.ts#L165-L172
This assumption seems to be outdated with the most recent xcode version. This is a console.log of all the groups of my project during prebuild:
'13B07FAE1A68108700A75B9A': {
isa: 'PBXGroup',
children: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object]
],
name: 'MyApp',
sourceTree: '"<group>"'
},
'13B07FAE1A68108700A75B9A_comment': 'MyApp',
'2D16E6871FA4F8E400B85C8A': {
isa: 'PBXGroup',
children: [ [Object], [Object] ],
name: 'Frameworks',
sourceTree: '"<group>"'
},
'2D16E6871FA4F8E400B85C8A_comment': 'Frameworks',
'832341AE1AAA6A7D00B99B32': {
isa: 'PBXGroup',
children: [],
name: 'Libraries',
sourceTree: '"<group>"'
},
'832341AE1AAA6A7D00B99B32_comment': 'Libraries',
'83CBB9F61A601CBA00E9B192': {
isa: 'PBXGroup',
children: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
indentWidth: 2,
sourceTree: '"<group>"',
tabWidth: 2,
usesTabs: 0
},
'83CBBA001A601CBA00E9B192': {
isa: 'PBXGroup',
children: [ [Object] ],
name: 'Products',
sourceTree: '"<group>"'
},
'83CBBA001A601CBA00E9B192_comment': 'Products',
'92DBD88DE9BF7D494EA9DA96': {
isa: 'PBXGroup',
children: [ [Object] ],
name: 'MyApp',
sourceTree: '"<group>"'
},
'92DBD88DE9BF7D494EA9DA96_comment': 'MyApp',
BB2F792B24A3F905000567C9: {
isa: 'PBXGroup',
children: [ [Object] ],
name: 'Supporting',
path: 'MyApp/Supporting',
sourceTree: '"<group>"'
},
BB2F792B24A3F905000567C9_comment: 'Supporting',
D65327D7A22EEC0BE12398D9: {
isa: 'PBXGroup',
children: [ [Object], [Object] ],
path: 'Pods',
sourceTree: '"<group>"'
},
D65327D7A22EEC0BE12398D9_comment: 'Pods',
D7E4C46ADA2E9064B798F356: {
isa: 'PBXGroup',
children: [ [Object] ],
name: 'ExpoModulesProviders',
sourceTree: '"<group>"'
},
D7E4C46ADA2E9064B798F356_comment: 'ExpoModulesProviders',
'73803047A536459280588A51': {
isa: 'PBXGroup',
children: [
[Object: null prototype],
[Object: null prototype],
[Object: null prototype],
[Object: null prototype]
],
name: 'OneSignalNotificationServiceExtension',
path: 'OneSignalNotificationServiceExtension',
sourceTree: '"<group>"'
},
I noticed, that this group:
D65327D7A22EEC0BE12398D9: {
isa: 'PBXGroup',
children: [ [Object], [Object] ],
path: 'Pods',
sourceTree: '"<group>"'
},
D65327D7A22EEC0BE12398D9_comment: 'Pods',
has no name either and that the script wrongfully adds onesignal to it, which seems to cause this error. You can also notice, that the implicit assumption of the current code:
if (groups[key].name === undefined) {
is that a group is allways represented by a js object. This seems to be outdated as well, there are entries that contain strings for comments.
I fixed the issue locally on my machine by changing the if condition to:
if (typeof groups[key] === "object" && groups[key].name === undefined && groups[key].path === undefined) {
I cannot completely verify this solution as I have a second issue unrelated to onesignal blocking my build, but maybe these findings will help someone.
Having this issue as well. Every time I run prebuild OneSignal gets added as a build target, even if there already is an instance of it as a target. I end up having to open XCode manually to delete these new build targets, or else builds simply won't work.
Having this issue as well. Every time I run prebuild OneSignal gets added as a build target, even if there already is an instance of it as a target. I end up having to open XCode manually to delete these new build targets, or else builds simply won't work.
What should I do in Xcode to solve the problem?
Same here, and I have no XCode as my project is expo managed
Ok after building the app a LOT of times on EAS, I managed to narrow down the problematic line in our case. It turns out that removing configuration line associatedDomains: ["applinks:your.domain"]
in app.config.js
fixes the issue and results in a successful build. I have NO IDEA why, as this seems completely unrelated. Still investigating though, as my app needs universal links...
Anybody have an idea what this could be? would be very grateful for any hints!
EDIT: Solution found
After a lot of hair pulling I found the cause of my issue: In the XCode logs there was a line about provisioning profile:
Provisioning profile "*[expo] xx.xx.xx AppStore 2024-02-07T08:50:07.256Z" doesn't support the Associated Domains capability.
After going to my apple developer's account, I found the provisioning profile section (which was overloaded with too many profiles) and delete many Expired and Invalid profiles.
Then I re-generated new provisioning profiles with the command eas credentials
(then follow the instructions).
Then I rebuilt my app and it worked.
Hope this helps
I have the same problem and the solution provided by @gkpo doesn't seem to help unfortunately