react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

arm64 problem on Mac M1

Open JamesBond95470 opened this issue 5 years ago • 22 comments

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

JamesBond95470 avatar Feb 01 '21 16:02 JamesBond95470

+1

RatebSeirawan avatar Feb 03 '21 13:02 RatebSeirawan

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

Hani-Ghazi avatar Feb 03 '21 13:02 Hani-Ghazi

+1

dcolin avatar Feb 05 '21 16:02 dcolin

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

Unfortunately no :( No answers on this topic from OneSignal

JamesBond95470 avatar Feb 08 '21 16:02 JamesBond95470

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.

rgomezp avatar Feb 09 '21 23:02 rgomezp

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

rohitkum28 avatar Feb 10 '21 06:02 rohitkum28

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

JamesBond95470 avatar Feb 10 '21 09:02 JamesBond95470

Same error here

renatobentorocha avatar Feb 18 '21 20:02 renatobentorocha

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

dcolin avatar Feb 19 '21 07:02 dcolin

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

renatobentorocha avatar Feb 19 '21 20:02 renatobentorocha

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

dcolin avatar Feb 24 '21 10:02 dcolin

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!

rgomezp avatar Apr 07 '21 22:04 rgomezp

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.

ddevilcore avatar Apr 20 '21 09:04 ddevilcore

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 ?

alaindresse avatar Apr 23 '21 17:04 alaindresse

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.

ddevilcore avatar Apr 24 '21 18:04 ddevilcore

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'

Yann-prak avatar May 05 '21 17:05 Yann-prak

Happens the same error even using the branch that is mentioned by @rgomezp. Hope they can fix it soon

romonsalve avatar Jul 01 '21 20:07 romonsalve

Same error.. Can anyone has solution?

/Users/MyHost/Documents/MyProjects/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/MyHost/Documents/MyProjects/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'

botlavenkateshh2020 avatar Jul 04 '21 10:07 botlavenkateshh2020

Still happens the same error by using XCFramework branch @rgomezp. Anyone has a solution?

oguzhnatly avatar Aug 04 '21 07:08 oguzhnatly

Howdy @oguzhnatly , You no longer need to use that special branch as the XCFramework version is now used by default as defined by the SDKs podspec.

Somebody from a different but similar issue said:

I simply replaced "OneSignal" with "OneSignalXCFramework" in Podfile and did pod update. Now I'm able to run project on simulator.

Make sure you are using the latest SDK and that you update the pods.

Hope that works for you.

rgomezp avatar Aug 18 '21 00:08 rgomezp