It is very new to me see this problem which started happening recently. Previously my app used to work fine on the iOS simulator by running this command react-native run-ios
. Now I have done a lot of research and made my app run via XCode. But somehow the metro bundler is not linked when the app runs via XCode.
I tried running the app via react-native run-ios
and every time I am seeing this error. It is too big to copy paste every error here, but here are some of them:
Undefined symbols for architecture x86_64:"Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from: generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o)ld: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)** BUILD FAILED **The following build commands failed: Ld /Users/careerlabsdev/Library/Developer/Xcode/DerivedData/CareerLabs_Elev8-gxcfanteiuxazegkgwkjkrjxbdmw/Build/Products/Debug-iphonesimulator/CareerLabs.app/CareerLabs normal(1 failure)
I have done a lot of things to make it to work. The only success I got here is, while running the command react-native run-ios, it opens up the metro bundler server
. After that it fails with giving a 1000 lines of error. I picked the error which had some cream part. Some key words to pick from the error:
- ld: symbol(s) not found for architecture x86_64
- clang: error: linker command failed with exit code 1 (use -v to see invocation)
- Did not understand the word Ld, which is listed under BUILD FAILED
What I did is as follows:
- Deleting node_modules, Pods. Cleaning the build from XCode. Running
npm install
and then cd ios && pod install
and then ran the command react-native run-ios
- Deleting Pods, Podfile.lock. Did
pod install
and then in the root react-native run-ios
- Doing these:
rm -rf ~/Library/Caches/CocoaPodsrm -rf Podsrm -rf ~/Library/Developer/Xcode/DerivedData/*pod deintegratepod setuppod installcd ..react-native run-ios
- Restarted the system, and ran the command again
react-native run-ios
- Added arm64 in the Excluded Architecture from XCode. Please note, this enabled me to
build and run
the app successfully on XCode. But it doesn't get attached to the metro bundler server. Looks like it runs the release mode only. - Updated my package
react-native-gesture-handler
to the latest one which is 1.10.3, to see if that removes my problem. But no luck :(
My Podfile look like this:
platform :ios, '10.0' use_flipper!({'Flipper' => '0.81.0'}) post_install do |installer| flipper_post_install(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' end end end
I am out of options now, and waiting for some insight to be given. It is indeed frustrating to see an error on something which never created a problem. I am using Apple M1 Chip Macbook. Would appreciate any kind of help on this.
Update V1.0
- I have tried commenting down the
use_flipper!()
, from the /ios/Podfile
, and then redid the same things, like removing Pods
, Podfile.lock
. Running this command, pod update && pod install && cd.. && npm run ios
. Ran into multiple issues. God knows what actually the issue is with XCode and React Native on Apple M1.
Update V2.0
I have found some significant places where the developers are complaining about the same. XCode has forced updated my version to 12.5, without my notice. And now XCode is creating a problem with RN Older projects. Here are the supportive links for the same:
I hope this may give some insight to the developers who are confused like me. Please take a look, and looks like Facebook
is fixing it, but don't know when. Have to keep an eye on it :/