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

arm64 problem on Mac M1 #1157

Closed
JamesBond95470 opened this issue Feb 1, 2021 · 22 comments
Closed

arm64 problem on Mac M1 #1157

JamesBond95470 opened this issue Feb 1, 2021 · 22 comments

Comments

@JamesBond95470
Copy link

JamesBond95470 commented Feb 1, 2021

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
@RatebSeirawan
Copy link

+1

@Hani-Ghazi
Copy link

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

@dcolin
Copy link

dcolin commented Feb 5, 2021

+1

@JamesBond95470
Copy link
Author

JamesBond95470 commented Feb 8, 2021

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

Unfortunately no :( No answers on this topic from OneSignal

@rgomezp
Copy link
Contributor

rgomezp commented Feb 9, 2021

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.

@rohitkum28
Copy link

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

@JamesBond95470
Copy link
Author

JamesBond95470 commented Feb 10, 2021

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

@renatobentorocha
Copy link

Same error here

@dcolin
Copy link

dcolin commented Feb 19, 2021

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

@renatobentorocha
Copy link

renatobentorocha commented Feb 19, 2021

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

@dcolin
Copy link

dcolin commented Feb 24, 2021

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

@rgomezp
Copy link
Contributor

rgomezp commented Apr 7, 2021

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 rgomezp closed this as completed Apr 7, 2021
@ddevilcore
Copy link

ddevilcore commented Apr 20, 2021

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.

@alaindresse
Copy link

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 ?

@ddevilcore
Copy link

ddevilcore commented Apr 24, 2021

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.

@Yann-prak
Copy link

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'

@romonsalve
Copy link

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

@botlavenkateshh2020
Copy link

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'

@oguzhnatly
Copy link

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

@rgomezp
Copy link
Contributor

rgomezp commented Aug 18, 2021

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.

@Ebeldev
Copy link

Ebeldev commented Jul 13, 2022

I was able to get ride of the error.

What I did you may ask !! .

I use to open xcodeproj file but instead open xcworkspace file and it worked.

@kosbog
Copy link

kosbog commented Jul 21, 2022

OneSignal/react-native-onesignal#5e7380a4

I faced this issue #1260 (comment)
Does the fix still work for M1 users?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests