customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

No such module 'CioMessagingPushAPN' #291

Closed TheGipsyDanger closed 4 weeks ago

TheGipsyDanger commented 1 month ago

SDK version:

customerIo: 3.8.0 expo: 51

Environment: Development or Production

Development & Production

Are logs available?

Describe the bug

After following the steps for configuring Push Notifications, when accessing the file MyAppPushNotificationHandler, the message indicates that CioMessagingPushAPN was not found.

I have repeated the steps more than 3 times, and the error persists. It seems that there might be a missing step in the documentation.

To Reproduce

Expo Project Setup with Customer.io Push Notifications

1. Create a New Expo Project

  1. Create project:

    npx create-expo-app@latest
  2. Navigate to Your Project Directory:

    cd MyNewProject
  3. Transform in bare workflow:

    npx expo prebuild

    This will create native files for iOS and Android and change your project to Bare Workflow.

  4. install customer-io:

    npm install customerio-reactnative

    2. Install Pods

To use native functionalities not supported by Expo Managed Workflow, you need to migrate to Bare Workflow.

  1. Eject to Bare Workflow:

    cd ios && pod install
  2. Set Up Customer.io: Follow the official Customer.io documentation to integrate their SDK with your React Native project. This usually involves setting up their library and configuring the app for push notifications.

  3. Configure iOS Push Notifications:

    • Open ios/MyNewProject.xcworkspace in Xcode.
    • Enable Push Notifications capability in your project settings.
    • Configure APNs with Customer.io according to their setup guide.

Set up push notifications

Expected behavior

Screenshots

Screenshot 2024-08-06 at 07 49 02

Additional context Example on: https://github.com/TheGipsyDanger/customer-io-example

mrehan27 commented 1 month ago

Hi @TheGipsyDanger. Sorry to hear about the issue you are facing. And thanks a lot for great details. Really appreciate the efforts you put into describing the issue, it's super helpful.

From quick overview, it seems like you have added push notification pod to NotificationServiceExtension target, but didn't add it to main target as suggested in step 1. Can you please try adding the following to your Podfile under app target (customerioexample target in shared example) and rebuild project to confirm if that works?

target 'customerioexample' do
  pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'
end

Let us know if this doesn't solve the problem for you. Please feel free to reach out with any questions you may have.

TheGipsyDanger commented 1 month ago

Hi @mrehan27

I have already repeated this step more than once and I am still encountering the same error

mrehan27 commented 1 month ago

@TheGipsyDanger I understand this could be frustrating and appreciate your cooperation while we debug this further. Looking at current Podfile, I don't see CioMessagingPushAPN pod added anywhere for customerioexample target. Can you please follow the suggestion above, rebuild the project, and push any changes you made so we can ensure we are debugging the same code?

In case it helps, MessagingPush pods have to be added twice (similar to how it is added in our sample app), once for the main target (customerioexample in shared code) and once for NotificationServiceExtension due to how targets work on iOS. In shared code, CioMessagingPushAPN pod is only added for NotificationServiceExtension and not for the main target. If it's not added for the main target, any files in main target will keep giving errors as they'll be unable to find the required pod.

Let me know if this helps, and please feel free to reach out with any questions you may have.

mrehan27 commented 4 weeks ago

Closing due to inactivity. Even though the issue is closed, please feel free to ask any questions you may have or reopen if needed.