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

'klaviyo_react_native_sdk-Swift.h' file not found #94

Closed
yasicmd opened this issue Feb 8, 2024 · 16 comments · Fixed by #134
Closed

'klaviyo_react_native_sdk-Swift.h' file not found #94

yasicmd opened this issue Feb 8, 2024 · 16 comments · Fixed by #134
Labels
bug Something isn't working cannot-reproduce

Comments

@yasicmd
Copy link

yasicmd commented Feb 8, 2024

Description

When I run the project using Xcode, I get the following error

'klaviyo_react_native_sdk-Swift.h' file not found

file path /Users/yasi/Appmaker/staging/node_modules/klaviyo-react-native-sdk/ios/KlaviyoReactNativeSdk.mm

I did the pod install and it shows in the Podfile.lock as below

- klaviyo-react-native-sdk (0.1.2):
    - KlaviyoSwift (= 3.0.2)
    - React-Core
- KlaviyoSwift (3.0.2):
    - AnyCodable-FlightSchool

Note
----
This issue happens in both my project and in the example project provided no error showned.


### Checklist

- [ ] I have determined whether this bug is also reproducible in a vanilla project
- [ ] If possible, I've reproduced the issue using the `master` branch of this package.
- [X] This issue hasn't been addressed in an [existing GitHub issue](https://github.com/klaviyo/klaviyo-react-native-sdk/issues) or [pull request](https://github.com/klaviyo/klaviyo-react-native-sdk/pulls).

### Expected behavior

```markdown
It should build the project after the pod install has been successfully done.

Actual behavior

'klaviyo_react_native_sdk-Swift.h' file not found

Steps to reproduce

No response

The Klaviyo React Native SDK version information

0.1.2

Environment Description

System:
  OS: macOS 14.1
  CPU: (8) arm64 Apple M1
  Memory: 92.23 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.0
    path: ~/.nvm/versions/node/v18.16.0/bin/node
  Yarn:
    version: 1.22.21
    path: ~/.nvm/versions/node/v18.16.0/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.0/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.3 AI-213.7172.25.2113.9123335
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.17
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.1
    wanted: 0.72.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: false

Note
------
pod version : 1.15.2

@yasicmd yasicmd added the bug Something isn't working label Feb 8, 2024
@ajaysubra
Copy link
Collaborator

@yasicmd this was reported by another developer here and we believe this is a issue with your derived data. Could you please follow the instructions from that comment and let us know if that fixes it for you. Thanks!

@evan-masseau
Copy link
Contributor

Hello, I am unable to reproduce this issue in a fresh clone of our SDK repo. Here are the exact steps I took, and the outcomes. Please note in particular the output from my npx react-native info, as your Environment has discrepancies from the expected environment for the Klaviyo React Native SDK.

  • git clone a new copy of this repo
  • yarn install in repo root directory
  • cd example/ios and pod install
  • npx react-native info from the example/ios directory:
System:
  OS: macOS 14.1.2
  CPU: (10) arm64 Apple M1 Max
  Memory: 18.15 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 3.6.1
    path: ~/.nvm/versions/node/v18.19.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "21"
      - "22"
      - "23"
      - "24"
      - "25"
      - "26"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-21 | Google APIs ARM 64 v8a
      - android-22 | ARM 64 v8a
      - android-22 | Google APIs ARM 64 v8a
      - android-23 | Google APIs ARM 64 v8a
      - android-24 | Google APIs ARM 64 v8a
      - android-25 | Google APIs ARM 64 v8a
      - android-28 | Google APIs ARM 64 v8a
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-29 | Google Play ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-UpsideDownCake-ext5 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.7
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Your react native version was behind
    wanted: 0.73.1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Hermes was false in your env
  newArchEnabled: false
  • Open example app's xcode workspace
  • Build the app (targeting an iOS 15.2 simulator)
  • Build succeeds and installs

Hope this helps. As Ajay referenced, cleaning your build folder and derived data would be a good first step, but I would also look closely at your environment.

@bendrobinson1998
Copy link

Guys this still isn't fixed, It seems to be IOS only. Can you please reopen this and re address it? Ive been trying all the suggestions and my environment is as recceomnded.

@ajaysubra
Copy link
Collaborator

@bendrobinson1998 Sorry that you are still facing this issue. Unfortunately, we are unable to reproduce this issue on our end. Just to clarify the steps you've taken - Have you tried this suggestion?

Also, the developer who opened this issue recently notified us that they are all set and hence this issue was closed. If you still believe that this is an issue with the SDK, please open a separate issue with all the details specific to your setup and we will look into it.

@bendrobinson1998
Copy link

Okay, so I have narrowed this down. When installing the package via Yarn or NPM there seems to be multiple methods missing from the package, such as the initialise function. When I clone the example app this is not the case. Please try replicating my bug on a fresh RN project and then install the SDK via yarn or NPM

@yasicmd
Copy link
Author

yasicmd commented Feb 22, 2024

@ajaysubra still the issue is not resolved fully i have to edit the file and use the provided temporary solution every time i install the sdk. Also I tried on a different system today but the issue is on that system also. I had to edit the file in the Klaviyo sdk to fix the issue.

Finally, to fix the issue i had to write a script to replace the import statement with the fixed import statement before every build to ensure smooth run.

So it will be better if you guys can find and fix this issue since other developers also having the issue.

@ajaysubra
Copy link
Collaborator

Thanks both for your response. @bendrobinson1998 I will try your steps to reproduce today and report back. In the meantime can you help me understand what you mean by,

multiple methods missing from the package, such as the initialise function

Since in the latest release 0.1.2 those methods are not available on the react native side.

@yasicmd can you please elaborate on what you mean by "provided temporary solution"?

@bendrobinson1998
Copy link

Ah I see, so initialisation can only be done in the native code, not via Klaviyo.initialize? The README.md still states you can initialise via react native layer:

import { Klaviyo } from 'klaviyo-react-native-sdk';
Klaviyo.initialize('YOUR_KLAVIYO_PUBLIC_API_KEY');

Regardless, initialisiation or not I cannot get the project to build for IOS when using yarn/npm install, it is building fine for android. IOS outputs the missing swift file error.

@ajaysubra
Copy link
Collaborator

You are right in that the latest release of the react native SDK 0.1.2 can't do initialize from the react native layer but we are in the process of making a new release 0.2.0 that allows react native developers to initialize and setToken from the react native code. This is why you are seeing that instructions in the readme. Once this release this to NPM soon, you'll be able to use those methods by pulling in the SDK via NPM/Yarn. I know this can be confusing, one suggestion I can make is to refer the NPM page instead of the repo readme for the exact state of the SDK since the repo will be in active development most of the times where as the NPM page will be static to a given release.

However, this is seperate from the issue you are facing with the header and we will look into it and let you know if we are able to reproduce it on our end. At the moment, our best suggestion is this.

@yasicmd
Copy link
Author

yasicmd commented Feb 22, 2024

@yasicmd can you please elaborate on what you mean by "provided temporary solution"?

https://github.com/klaviyo/klaviyo-react-native-sdk/pull/78/files

@bendrobinson1998
Copy link

However, this is seperate from the issue you are facing with the header and we will look into it and let you know if we are able to reproduce it on our end. At the moment, our best suggestion is this.

I have attempted this but it does not fix my issue.

@ajaysubra
Copy link
Collaborator

@yasicmd Just to be clear the PR you referenced isn't a solution we provided. The developer who opened that PR isn't a Klaviyo developer.

@ajaysubra
Copy link
Collaborator

@bendrobinson1998 We've tried to reproduce this on our end building a new app and installing the SDK like you suggested but still we are not able to reproduce this. Here are the commands I used if it's helpful -

npx react-native@latest init AwesomeProject1
cd AwesomeProject1
npm install klaviyo-react-native-sdk
cd ios
pod install
open AwesomeProject1.xcworkspace // will open xcode for you
npm start
// run the app on xcode 15.0

Unfortunately, at this point there are no indications that this is an issue with the SDK. One thing that we did discover is that there is an issue with cocoapods version 1.15.0 so if you are on this version please consider updating. Sorry we couldn't be of much help here. Good luck!

CC: @yasicmd

@yasicmd
Copy link
Author

yasicmd commented Feb 23, 2024

My pod version: 1.15.2

And my Xcode version: 15.0.1

The other system versions are
pod : 1.15.0
Xcode: 15.2

@youcefswoo
Copy link

what worked for me is to replace
#import <klaviyo_react_native_sdk-Swift.h>
by
#import <klaviyo_react_native_sdk/klaviyo_react_native_sdk-Swift.h>

@ajaysubra
Copy link
Collaborator

FYI folks, please look at this issue for info on the fix for this issue. TLDR- use release 0.2.1 (our latest at the time of writing this comment) to resolve this issue.

@evan-masseau evan-masseau linked a pull request Mar 26, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cannot-reproduce
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants