customerio / customerio-expo-plugin

MIT License
11 stars 9 forks source link

iOS build error - 'Consistency issue: no parent for object `NotificationService.m`' #152

Closed BrandonYuen closed 1 week ago

BrandonYuen commented 1 month ago

Hi,

We're trying to integrate the Customer IO SDK into our managed Expo app using this plugin. However, we are unable to successfully make an iOS build. I've followed the guide step by step.

We have the following related dependencies installed:

    "expo": "~51.0.24",
    "expo-notifications": "0.28.15",
    "@react-native-firebase/app": "^14.11.0",
    "@react-native-firebase/messaging": "^14.11.0",
    "customerio-expo-plugin": "^1.0.0-beta.15",
    "customerio-reactnative": "^3.9.1",

Error on build (Install pods):

Generating Pods project
[!] An error occurred while processing the post-install hook of the Podfile.
[Xcodeproj] Consistency issue: no parent for object `NotificationService.m`: `SourcesBuildPhase`, `SourcesBuildPhase`
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project/object/helpers/groupable_helper.rb:19:in `parent'
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project/object/build_file.rb:77:in `ascii_plist_annotation'
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project.rb:297:in `block in to_ascii_plist'
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project.rb:296:in `each'
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project.rb:296:in `to_ascii_plist'
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project.rb:365:in `block in save'
/Users/expo/.gems/arm64/gems/atomos-0.1.3/lib/atomos.rb:21:in `block in atomic_write'
/opt/homebrew/Cellar/ruby@2.7/2.7.8_1/lib/ruby/2.7.0/tempfile.rb:291:in `open'
/Users/expo/.gems/arm64/gems/atomos-0.1.3/lib/atomos.rb:17:in `atomic_write'
/Users/expo/.gems/arm64/gems/xcodeproj-1.24.0/lib/xcodeproj/project.rb:364:in `save'
/Users/expo/workingdir/build/node_modules/react-native/scripts/cocoapods/utils.rb:153:in `block in fix_library_search_paths'
/Users/expo/workingdir/build/node_modules/react-native/scripts/cocoapods/utils.rb:144:in `each'
/Users/expo/workingdir/build/node_modules/react-native/scripts/cocoapods/utils.rb:144:in `fix_library_search_paths'
/Users/expo/workingdir/build/node_modules/react-native/scripts/react_native_pods.rb:290:in `react_native_post_install'
/Users/expo/workingdir/build/ios/Podfile:62:in `block (3 levels) in from_ruby'
/Users/expo/.gems/arm64/gems/cocoapods-core-1.14.3/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:149:in `message'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:183:in `integrate'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:170:in `install!'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/command/install.rb:52:in `run'
/Users/expo/.gems/arm64/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:52:in `run'
/Users/expo/.gems/arm64/gems/cocoapods-1.14.3/bin/pod:55:in `<top (required)>'
/Users/expo/.gems/arm64/bin/pod:25:in `load'
/Users/expo/.gems/arm64/bin/pod:25:in `<main>'
[!] [Codegen] warn: using experimental new codegen integration
[!] `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `EB0886AADACE40B0B24D27CC` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
[!] Can't merge pod_target_xcconfig for pod targets: ["expo-dev-menu", "Main", "ReactNativeCompatibles", "SafeAreaView", "Vendored"]. Singular build setting DEFINES_MODULE has different values.
[!] Can't merge pod_target_xcconfig for pod targets: ["expo-dev-menu", "Main", "ReactNativeCompatibles", "SafeAreaView", "Vendored"]. Singular build setting DEFINES_MODULE has different values.
[!] Unable to read the license file `LICENSE` for the spec `MetricsReporter (2.0.0)`
[!] Unable to read the license file `LICENSE` for the spec `MetricsReporter (2.0.0)`
pod install exited with non-zero code: 1

I've searched this issues board but couldn't find anything related, except for https://github.com/customerio/customerio-expo-plugin/issues/118, however, we don't use OneSignal or any other dependency that already creates a NotificationService that I know of. I also did a expo prebuild -p ios but in those files I do not see a NotificationService class.

I hope someone can point me in the right direction or knows the solution. Thanks in advance! 🫶

ami-aman commented 1 month ago

Hey there !

Apologies that you are facing this issue.

The Consistency issue: no parent for object "NotificationService.m" typically arises when there are multiple files with the same class name and it can potentially cause a conflict.

Would you be able to confirm if you still encounter this error after running expo prebuild --clean? This will recreate the native directories and reinstall the plugin. Also, I recommend clearing out Derived Data, which might resolve any issues from conflicting files.

Let me know if the issue persists after trying these steps!

BrandonYuen commented 1 month ago

@ami-aman Thank you for your reply! Our builds are made via eas, that's where the error comes from. I re-tried the build there with the "Clear cache and retry" option, but to no avail.

I am not sure but I think a expo prebuild step would not be needed when we use a managed Expo project, since the builds are created on their runners. Unless I am missing something :)

Maybe another native dependency is using that NotificationService.m class name, but I could only think of react-native-firebase, that's why I listed it there. However, that does not seem to be it.

ami-aman commented 2 weeks ago

Hi @BrandonYuen Apologies for the delay in response and appreciate the patience.

It sounds like the issue persists despite clearing the cache on EAS. Given that, here are a few further suggestions:

ami-aman commented 1 week ago

Closing this issue due to inactivity. If you still need assistance or have a related question, feel free to open a new issue.