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

[Bug]: Build fails with "The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and "")" after updating xcode to 15.2 #226

Closed
mauricedoepke opened this issue Feb 22, 2024 · 7 comments · Fixed by #228

Comments

@mauricedoepke
Copy link

mauricedoepke commented Feb 22, 2024

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:

// Add the new PBXGroup to the top level group. This makes the
// files / folder appear in the file explorer in Xcode.
const groups = xcodeProject.hash.project.objects["PBXGroup"];
Object.keys(groups).forEach(function(key) {
if (groups[key].name === undefined) {
xcodeProject.addToPbxGroup(extGroup.uuid, key);
}
});

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.

@mauricedoepke mauricedoepke changed the title Build fails with "The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and "")" after updating xcode to the most recent version Build fails with "The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and "")" after updating xcode to 15.2 Feb 22, 2024
@mauricedoepke mauricedoepke changed the title Build fails with "The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and "")" after updating xcode to 15.2 [Bug]: Build fails with "The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and "")" after updating xcode to 15.2 Feb 22, 2024
@AgenteDog
Copy link

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.

@aledebla03
Copy link

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?

@gkpo
Copy link

gkpo commented Mar 27, 2024

Same here, and I have no XCode as my project is expo managed

@gkpo
Copy link

gkpo commented Mar 28, 2024

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

@KristianLentino99
Copy link

I have the same problem and the solution provided by @gkpo doesn't seem to help unfortunately

rgomezp added a commit that referenced this issue May 8, 2024
Motivation: other groups may have an undefined "name" property other than the top level

Fix #226
@marcelobarbosaO
Copy link

for me the solution was to delete invalid and expired profiles and certificates in the apple account, and generate them all again via eas credentials, both for the app and for the onesignal extension.

@rgomezp
Copy link
Contributor

rgomezp commented Jun 4, 2024

Fixed. Install 2.0.3

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

Successfully merging a pull request may close this issue.

7 participants