React-native-onesignal: arm64 problem on Mac M1

Created on 1 Feb 2021  路  16Comments  路  Source: OneSignal/react-native-onesignal

Description:
Hi i am getting this error when I try to compile my react-native app on my mac M1

in /Users/MyName/work/MyProject/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal(OneSignal-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/MyName/work/MyProject/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'

Environment
Mac M1
Xcode 12.4
React : 16.13.1
React native : 0.63.4
react-native-onesignal: 4.0.3

Steps to Reproduce Issue:

  1. npm install --save react-native-onesignal
  2. cd iOS && pod install
  3. run project
Compatibility Issue

Most helpful comment

Howdy,
Thank you for your patience. Here's what you need to do:

  1. Update your react-native-onesignal dependency to use OneSignal/react-native-onesignal#5e7380a4
  2. Rebuild your project's node-modules
  3. cd ios && pod install --repo-update

as so in your package.json:

"dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.3",
    "react-native-onesignal": "OneSignal/react-native-onesignal#5e7380a4"
  },

Enjoy!

Edit: If you're wondering what this is doing, it is pulling a specific commit from a branch in the Github repository. That branch updates the podspec file to use the XCFramework version of the OneSignal pod which supports M1.

After trying this, I have started getting the following error

/Users/my_path/node_modules/react-native-onesignal/ios/RCTOneSignal/RCTOneSignalExtensionService.m:4:9: 'OneSignal.h' file not found

All 16 comments

+1

I'm stuck with this issue, even I'm able to run it on the simulator in debug mode

+1

I'm stuck with this issue too. Did you solve this? @JamesBond95470

Unfortunately no :( No answers on this topic from OneSignal

Howdy,
Thank you for your patience. Here's what you need to do:

  1. Update your react-native-onesignal dependency to use OneSignal/react-native-onesignal#5e7380a4
  2. Rebuild your project's node-modules
  3. cd ios && pod install --repo-update

as so in your package.json:

"dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.3",
    "react-native-onesignal": "OneSignal/react-native-onesignal#5e7380a4"
  },

Enjoy!


Edit: If you're wondering what this is doing, it is pulling a specific commit from a branch in the Github repository. That branch updates the podspec file to use the XCFramework version of the OneSignal pod which supports M1.

Howdy,
Thank you for your patience. Here's what you need to do:

  1. Update your react-native-onesignal dependency to use OneSignal/react-native-onesignal#5e7380a4
  2. Rebuild your project's node-modules
  3. cd ios && pod install --repo-update

as so in your package.json:

"dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.3",
    "react-native-onesignal": "OneSignal/react-native-onesignal#5e7380a4"
  },

Enjoy!

Edit: If you're wondering what this is doing, it is pulling a specific commit from a branch in the Github repository. That branch updates the podspec file to use the XCFramework version of the OneSignal pod which supports M1.

After trying this, I have started getting the following error

/Users/my_path/node_modules/react-native-onesignal/ios/RCTOneSignal/RCTOneSignalExtensionService.m:4:9: 'OneSignal.h' file not found

I have the same error after your edit @rgomezp

Lexical or Preprocessor Issue Group: /Users/my-name/work/my-project/node_modules/react-native-onesignal/ios/RCTOneSignal/RCTOneSignalExtensionService.m:4:9: 'OneSignal.h' file not found

Same error here

Same to me... Any idea to fix this problem?

Hello,

I created a new React Native project with only one dependence, the OneSignal. I has some issues with Flipper, but after revolved it, all worked fine.

So I did the upgrade of the my real project and find that other dependences had some issues. Below the steps that I followed to do all work:

- Upgrade the React Native version:
  npx react-native upgrade

- Update the IOS Flipper-Folly version in Pod File:
  use_flipper!({ 'Flipper-Folly' => '2.3.0' })

- Install the OneSignal last one version:
  yarn add react-native-onesignal

- Install the PSPDFKit last one version:
  yarn add github:PSPDFKit/react-native 

pod update --repo-update

Disable Flipper and run Xcode using Rosetta 2 works for me!

Thanks for your workarounds y'all.

Since there hasn't been any further activity. I'm going to go ahead and close out this issue. Please comment if you have any further questions.

Enjoy!

I check all the solutions that was provided here, but anyway problem is still not resolved
I have MAC on M1 and this dependency (called OneSignal) only gave me an errors every time when i want to deploy my project.

Having the same problem here. Noticed that the issue is very similar to that raised for the cordova sdk (see this issue) where @rgomezp's last (2 days old) comment mentioned that the "The Cordova major release is just around the corner". What is the situation for react-native ?

UPD: Solve this error 2 days ago by add Exclude Architecture option in Build settings & custom option VALID_ARCHS. Also, now I'm launching Xcode with Rosetta.

Still not working for me. I can run my app on my real device and now it's not working on a simulator. I know we can't send push notification to simulator but I still need to test my app on simulator.
I've been following all the workarounds but none is working for the simulator. Do you have any an idea ?

/Users/MyName/work/MyProject/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal(OneSignal-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/MyName/work/MyProject/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'

Was this page helpful?
0 / 5 - 0 ratings