Closed niklavsBariss closed 4 months ago
Hey @niklavsBariss thanks for reporting this issue to us. We have had other users report this as well and we've tried extensively to reproduce this on our end and we've not succeeded. Based on our research we believe this is probably something to do with derived data with xcode local dev setup. Here's a suggestion we've been making to our developers since we are not able to reproduce it ourselves. Please let us know if the above suggestion works for you. Good luck!
Thank you for responding @ajaysubra but no success - I tried Clean Build Folder
, fully restarting Xcode, completely deleting Derived data of the project, but the issue persists.
To help me troubleshoot: which file should be imported by #import <klaviyo_react_native_sdk-Swift.h>
?
Just to note I’m still getting the same error, albeit I use expo.
The fix proposed by youcefswoo in #78 works for me
I'm facing the same issue on React Native 0.73.2 and klaviyo-react-native-sdk 0.2.0. I tried Clean Build Folder
, closing xCode and reinstalling the package, but still the same issue. Any other ideas how to fix it?
I think in my case the issue is related to using additionally @react-native-firebase/messaging
as mentioned in the documentation to handle requesting permissions and collecting push tokens. When installing just klaviyo-react-native-sdk
the issue does not occur in my case. Any ideas why there is that issue together with the firebase package?
I think in my case the issue is related to using additionally
@react-native-firebase/messaging
as mentioned in the documentation to handle requesting permissions and collecting push tokens. When installing justklaviyo-react-native-sdk
the issue does not occur in my case. Any ideas why there is that issue together with the firebase package?
My project also uses @react-native-firebase , maybe a clash is happening with this library when building?
package.json below if helps:
{ "name": "...", "version": "1.0.0", "main": "expo-router/entry", "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "@apollo/client": "^3.9.5", "@react-native-firebase/app": "^18.5.0", "@react-native-firebase/functions": "^18.5.0", "@react-native-picker/picker": "2.6.1", "@react-navigation/material-bottom-tabs": "^6.2.16", "@react-navigation/native": "^6.1.7", "@react-navigation/stack": "^6.3.17", "@rneui/base": "^4.0.0-rc.7", "@rneui/themed": "^4.0.0-rc.8", "@shopify/flash-list": "1.6.3", "apollo-link-rest": "^0.9.0", "expo": "50", "expo-blur": "~12.9.2", "expo-build-properties": "~0.11.1", "expo-constants": "~15.4.5", "expo-crypto": "~12.8.1", "expo-dev-client": "~3.3.8", "expo-device": "~5.9.3", "expo-linking": "~6.2.2", "expo-localization": "~14.8.3", "expo-notifications": "~0.27.6", "expo-router": "~3.4.7", "expo-splash-screen": "~0.26.4", "expo-status-bar": "~1.11.1", "expo-system-ui": "~2.9.3", "firebase": "^10.4.0", "graphql": "^16.8.1", "native-notify": "^3.0.6", "onesignal-expo-plugin": "^2.0.2", "qs": "^6.11.2", "react": "18.2.0", "react-native": "0.73.4", "react-native-dropdown-picker": "^5.4.6", "react-native-gesture-handler": "~2.14.0", "react-native-marquee": "^0.5.0", "react-native-mmkv": "^2.10.2", "react-native-onesignal": "^5.0.6", "react-native-paper": "^5.10.1", "react-native-reanimated": "~3.6.2", "react-native-reanimated-carousel": "^3.5.1", "react-native-safe-area-context": "4.8.2", "react-native-screens": "~3.29.0", "react-native-toast-message": "^2.1.6", "react-native-vector-icons": "^10.0.0", "react-native-webview": "13.6.4", "zustand": "^4.4.1" }, "devDependencies": { "@babel/core": "^7.20.0" }, "engines": { "node": ">= 18.0.0" }, "private": true }
Thank you for responding @ajaysubra but no success - I tried
Clean Build Folder
, fully restarting Xcode, completely deleting Derived data of the project, but the issue persists.To help me troubleshoot: which file should be imported by
#import <klaviyo_react_native_sdk-Swift.h>
?
Hi @niklavsBariss sorry that didn't work. klaviyo-react-native-sdk-Swift.h
is a xcode generated file that exposes swift interfaces to objective-c code. In our case that's KlaviyoBridge.swift
that is imported by KlaviyoReactNativeSDK.mm
I've been looking into this and I may have stumbled upon some official apple docs which suggests to use what #78 suggests but in the meantime can either of you please check what Generated Header Name for klaviyo-react-native-sdk
is in your Pods target? When I check our react native test project it says klaviyo-react-native-sdk-Swift.h
.
Just to be clear, I'm not suggesting any fixes yet just still in the discovery process and trying to understand why our test app succeeds while some of our customers have reported failures.
@ajaysubra same as yours
We decided to use #78 with patch-package for now with some heavy, test enforced TODO check after updating
I think in my case the issue is related to using additionally
@react-native-firebase/messaging
as mentioned in the documentation to handle requesting permissions and collecting push tokens. When installing justklaviyo-react-native-sdk
the issue does not occur in my case. Any ideas why there is that issue together with the firebase package?
We are also using firebase messaging I would add firebase to my clean test app to test this theory, but the installation is quite involved
It's the same for both cases, when klaviyo-react-native-sdk
is installed alone or with @react-native-firebase/messaging
@ajaysubra would you need anything else from our side to help you investigate the issue?
Hey folks, we have narrowed down the issue to firebase react native, specifically this step in the setup. Adding use_frameworks! :linkage => :static
to your podfile makes importing our SDK as a framework as well and hence the import that we have needs to be #import <klaviyo_react_native_sdk/klaviyo_react_native_sdk-Swift.h>
as some of you have pointed out. The reason we were unable to reproduce was we were not importing our SDK as a framework and when you do that your import statement has to be #import <klaviyo_react_native_sdk-Swift.h>
.
The good news is we know what the issue is and are able to reproduce it. As I mentioned this is related to using firebase react native SDK and how it has some instructions that change the way our SDK is imported by cocoapods. The bad news is we have users who do not use frameworks and we also need to support them as well. We are exploring solutions and will update once we have one. Unfortunately, I don't have an exact timeline of when we'll have a solution but know that we are actively working on this. Thanks!
As an update, created #132 PR to address this issue. Totally optional, but if any of y'all want to test it out below are the steps.
npm install git@github.com:klaviyo/klaviyo-react-native-sdk.git#38fb354a34da1b6e8edaa7f25e98f48daf0b73de
in the root directory of your projectpod install
in the ios directory of your project.We will go through the review process and merge the PR in and we are working through another issue so we might batch the release. Will keep y'all posted when we release the fixes. Thanks for your patience with this issue.
Totally optional, but if any of y'all want to test it out below are the steps.
Tested and working great, thank-you!
Checklist
master
branch or latest release of this package.Description
Steps to reproduce
yarn add klaviyo-react-native-sdk
Add code to Podfile
pod install
Run from XCode or
yarn ios
I tried doing the same with a clean react native 0.71.13 project, but didn't have the same issue.
The Klaviyo React Native SDK version information
0.2.0
Environment Description