react native ios app not running in apple macbook m1 chip laptop - ios

i am having my react native project with version 0.64.4 now i am trying to set up this project in my new mac book but when i run npx react-native run-ios i get this error but when i tried to run this app in macbook intel chip laptop it runs successfully but faces this issues in macbook m1 chip laptop(i tried pod install it is installed correctly)
my enviroment info
react-native info
System:
OS: macOS 13.1
CPU: (8) arm64 Apple M1
Memory: 113.38 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.6.0 - /opt/homebrew/bin/node
Yarn: Not Found
npm: 9.4.0 - /opt/homebrew/bin/npm
Watchman: 2023.02.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/accelerlabsolutions/.rvm/gems/ruby-2.7.6/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9477386
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: ^0.64.1 => 0.64.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
npx react-native run-ios
Error
"_swift_unknownObjectWeakInit", referenced from:
_$s9InputMask23MaskedTextFieldDelegateC13primaryFormat12autocomplete0I7OnFocus8autoskip11rightToLeft13affineFormats27affinityCalculationStrategy15customNotations02oncD15ChangedCallback16allowSuggestionsACSS_S4bSaySSGAA08AffinitysT0OSayAA8NotationVGySo06UITextA0_p_SSSbtcSgSbtcfc in libInputMask.a(MaskedTextFieldDelegate.o)
_$s9InputMask23MaskedTextFieldDelegateCACycfc in libInputMask.a(MaskedTextFieldDelegate.o)
_$s9InputMask22MaskedTextViewDelegateC13primaryFormat12autocomplete0I7OnFocus8autoskip11rightToLeft13affineFormats27affinityCalculationStrategy15customNotations02oncD15ChangedCallback16allowSuggestionsACSS_S4bSaySSGAA08AffinitysT0OSayAA8NotationVGySo06UITextA0_p_SSSbtcSgSbtcfc in libInputMask.a(MaskedTextViewDelegate.o)
_$s9InputMask22MaskedTextViewDelegateCACycfc in libInputMask.a(MaskedTextViewDelegate.o)
_$s9InputMask010MaskedTextA8ListenerC13primaryFormat12autocomplete0H7OnFocus8autoskip11rightToLeft13affineFormats27affinityCalculationStrategy15customNotations02oncD15ChangedCallback16allowSuggestionsACSS_S4bSaySSGAA08AffinityrS0OSayAA8NotationVGySo06UITextA0_p_SSSbtcSgSbtcfc in libInputMask.a(MaskedTextInputListener.o)
_$s9InputMask010MaskedTextA8ListenerCACycfc in libInputMask.a(MaskedTextInputListener.o)
"_swift_unknownObjectWeakLoadStrong", referenced from:
_$s9InputMask23MaskedTextFieldDelegateC8listenerAA0cdeF8Listener_pSgvg in libInputMask.a(MaskedTextFieldDelegate.o)
_$s9InputMask23MaskedTextFieldDelegateC8listenerAA0cdeF8Listener_pSgvM in libInputMask.a(MaskedTextFieldDelegate.o)
_$s9InputMask22MaskedTextViewDelegateC8listenerAA0cdeF8Listener_pSgvg in libInputMask.a(MaskedTextViewDelegate.o)
_$s9InputMask22MaskedTextViewDelegateC8listenerAA0cdeF8Listener_pSgvM in libInputMask.a(MaskedTextViewDelegate.o)
_$s9InputMask010MaskedTextA8ListenerC8listenerAA02Oncd7ChangedE0_pSgvg in libInputMask.a(MaskedTextInputListener.o)
_$s9InputMask010MaskedTextA8ListenerC8listenerAA02Oncd7ChangedE0_pSgvM in libInputMask.a(MaskedTextInputListener.o)
"_swift_updateClassMetadata2", referenced from:
_$s9InputMask18OptionalValueStateCMr in libInputMask.a(OptionalValueState.o)
"_swift_willThrow", referenced from:
_$s9InputMask8CompilerC22determineInheritedType33_B3F36BB0FA1A2C10D03E581AB8FCA34DLL16forLastCharacterAA10ValueStateC0uF0OSJSg_tKF in libInputMask.a(Compiler.o)
_$s9InputMask8CompilerC26compileWithCustomNotations33_B3F36BB0FA1A2C10D03E581AB8FCA34DLL_6stringAA5StateCSJ_SStKF in libInputMask.a(Compiler.o)
_$s9InputMask8CompilerC24determineCustomStateType33_B3F36BB0FA1A2C10D03E581AB8FCA34DLL12forCharacterAA05ValueF0C0fG0OSJ_tKF in libInputMask.a(Compiler.o)
_$s9InputMask15FormatSanitizerC15checkOpenBraces33_9630C2BFB0C1EEC80D8C490909BFFB6BLLyySSKF in libInputMask.a(FormatSanitizer.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i want to run ios app successfully

try this
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf node_modules yarn.lock
cd ios
rm -rf Pods Podfile.lock
cd ..
yarn
cd ios
arch -x86_64 pod install
cd ..
npx react-native run-ios

Related

Xcode 13 archive failed: ipatool failed with an exception: #<CmdSpec::NonZeroExitException

When using latest React-native version, an error occurs when attempting to archive and export a release build through xcodebuild.
ipatool failed with an exception: #<CmdSpec::NonZeroExitException: $ Xcode.app/Contents/Developer/usr/bin/python3 /Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool -v -t /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin --sdk /Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -o /var/folders/v1/wd4zzzf10pzbbgtwf94wnb4h0000gn/T/ipatool20221003-10540-akdneb/thinned-out/arm64/Payload/BookingKoala\ For\ Providers.app/Frameworks/hermes.framework/hermes --generate-dsym /var/folders/v1/wd4zzzf10pzbbgtwf94wnb4h0000gn/T/ipatool20221003-10540-akdneb/thinned-out/arm64/Payload/BookingKoala\ For\ Providers.app/Frameworks/hermes.framework/hermes.dSYM --strip-swift-symbols /var/folders/v1/wd4zzzf10pzbbgtwf94wnb4h0000gn/T/ipatool20221003-10540-akdneb/thinned-in/arm64/Payload/BookingKoala\ For\ Providers.app/Frameworks/hermes.framework/hermes Status: pid 10975 exit 1 Stdout: SDK path: /Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk
React-native :: 0.70.1
npx react-native info
System:
OS: macOS 11.3
CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU # 2.60GHz
Memory: 384.45 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.1 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
#react-native-community/cli: Not Found
react: ^18.2.0 => 18.2.0
react-native: ^0.70.1 => 0.70.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Updated react-native version
Ensure you have XCode <= 13.2.1
Attempt to archive and export a release build using xcodebuild

RCT-Folly-Build-Detox-React-Native

Error:
The following build commands failed:
CompileC /Path/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/i386/F14Table.o /Path/ios/Pods/RCT-Folly/folly/container/detail/F14Table.cpp normal i386 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
(1 failure)
Pre-Condition:
Follow the setup detox latest version
detox build --configuration iOS file.ts
-Environment (please complete the following information):
Detox: ^19.6.5
React Native: 0.67.4
Node:v16.16.0
Device: Iphone 13 simulator
Xcode: 13.4.1 (13F100)
iOS: 15.0
macOS: Monterey
jest: 28.1.2
Had to add "-UseModernBuildSystem=YES -arch x86_64" to the build settings step to resolve.

React Native application start throwing errors after using react-native-track-player both build and start

React Native application build was working recently, But now one critical package that I'm using as a part of the essential feature is started throwing errors on IOS build.
Following are the build error details, and after some search added a swift empty file to create a bridge but the results are still the same.
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'react-native-track-player' from project 'Pods')
CompileSwift normal x86_64 /Users/c0d3/Projects/Zeefa/gem-mobile-app/node_modules/react-native-track-player/ios/RNTrackPlayer/Vendor/SwiftAudio/Classes/NowPlayingInfoController/NowPlayingInfoProperty.swift (in target 'react-native-track-player' from project 'Pods')
CompileSwift normal x86_64 /Users/c0d3/Projects/Zeefa/gem-mobile-app/node_modules/react-native-track-player/ios/RNTrackPlayer/Models/PitchAlgorithms.swift (in target 'react-native-track-player' from project 'Pods')
CompileSwift normal x86_64 /Users/c0d3/Projects/Zeefa/gem-mobile-app/node_modules/react-native-track-player/ios/RNTrackPlayer/Vendor/SwiftAudio/Classes/QueuedAudioPlayer.swift (in target 'react-native-track-player' from project 'Pods')
(4 failures)
Given is the react-native info response
System:
OS: macOS 12.2.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU # 2.60GHz
Memory: 162.65 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
Yarn: Not Found
npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 17.0.1 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
The issue is with XCODE 13, till now I didn't get any workaround but when downgrading XCODE back to 12 and doing the same build it is working as expected.
For anyone stuck with the same issue, Until getting a proper solution I would suggest getting a MAC machine in AWS so that you can switch to any version of the OS and do the build. Make sure to delete or STOP the machine once the build is done as it is too costly.
https://aws.amazon.com/pm/ec2-mac

Flutter iOS build failed after Flutter 1.22 upgrade

I just upgraded my Flutter version to 1.22.0. After upgrading and making some changes for Firebase my Android app started working, but I am unable to build and run the iOS app on emulator or on physical device.
The terminal shows the following errors when I try to run the app in the emulator or physical device. The emulator runs on iOS 14 and the physical device is on 14.0.1.
Emulator: ld: symbol(s) not found for architecture x86_64
Actual device: ld: symbol(s) not found for architecture arm64
I also executed the following commands but still not working...
flutter clean && \
rm ios/Podfile ios/Podfile.lock pubspec.lock && \
rm -rf ios/Pods ios/Runner.xcworkspace && \
flutter run
Flutter Doctor:
[✓] Flutter (Channel stable, 1.22.0, on Mac OS X 10.15.7 19H2, locale en-US)
• Flutter version 1.22.0 at /Volumes/demouser/Flutter/FlutterSDK/flutter
• Framework revision d408d302e2 (7 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/demouserdemouser/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0.1, Build version 12A7300
• CocoaPods version 1.9.3
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.49.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.14.1
[✓] Connected device (1 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• No issues found!
pubspec.yaml
name: demo
description: demo
version: 1.0.0+1
environment:
sdk: ">=2.5.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
firebase_auth: ^0.18.1+1
cloud_firestore: ^0.14.1+2
firebase_messaging: ^6.0.16
firebase_storage: ^5.0.0-dev.2
firebase_core: ^0.5.0
firebase_admob: ^0.10.0+1
intl_translation: ^0.17.10+1
http: ^0.12.2
xml: ^4.5.1
shared_preferences: ^0.5.12
flutter_staggered_grid_view: ^0.3.0
flutter_signin_button: ^1.0.0
image_picker: ^0.6.7+11
mlkit: ^0.15.1
cached_network_image: ^2.3.2+1
permission_handler: ^5.0.1+1
url_launcher: ^5.7.2
share: ^0.6.5+2
simple_connectivity: ^0.1.1
us_states: ^1.0.3
cloud_functions: ^0.6.0+1
email_validator: ^1.0.4
package_info: ^0.4.3
device_info: ^0.4.2+8
expandable: ^4.1.4
launch_review: ^2.0.0
xml2json: ^4.4.0
purchases_flutter: ^1.3.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.5
flutter_icons:
image_path: "icon/new_icon.png"
android: false
ios: true
Terminal's output:
> Launching lib/main.dart on physical iPhone in debug mode...
> Automatically signing iOS for device deployment using specified
> development team in Xcode project: 5ABCDEFG9 Running Xcode build...
> Xcode build done. 118.3s
> Failed to build iOS app Error output from Xcode build: ↳
> 2020-10-06 10:59:58.676 xcodebuild[7528:47880] DTDeviceKit: deviceType from a578d1d6cb0d414525f7dc4c6cee was NULL
> 2020-10-06 10:59:58.778 xcodebuild[7528:47881] DTDeviceKit: deviceType from a578d1d6cb0d414525f7dc4c6cee was NULL
> 2020-10-06 10:59:58.778 xcodebuild[7528:47881] DTDeviceKit: deviceType from a578d1d6cb0d414525f7dc4c6cee was NULL
> ** BUILD FAILED **
Xcode's output:
↳
/Volumes/driveD/Flutter/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.2/ios/Classes/FLTURLLauncherPlugin.m:153:57: warning: 'keyWindow' is deprecated: first deprecated in iOS 13.0 - Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes [-Wdeprecated-declarations]
.keyWindow.rootViewController];
^
In module 'UIKit' imported from /Volumes/driveD/projects/new/demo/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:134:51: note: 'keyWindow' has been explicitly marked deprecated here
#property(nullable, nonatomic,readonly) UIWindow *keyWindow API_DEPRECATED("Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes", ios(2.0, 13.0));
-------
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
Error launching application on physical’s iPhone.
It looks like this problem is coming due to RevenueCat API. When I comment out the import purchases_flutter in the pubspec.yaml file then I am able to install the app but it crashes at startup saying connection lost.
rm -f ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings fixed the issue for me
There are a couple of different answers for this here on stackoverflow. If I am not mistaken, the switch to channel "stable" solved the issue for me, last time.
I have a similar erro
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
I also having problems after I upgrade to 1.22.0, I had to also upgrade the flutterFire package, and that seems to be my problem.
the versions that I'm using on pubspec.yaml:
firebase_core: ^0.5.0
cloud_firestore: ^0.14.1+2
firebase_auth: ^0.18.1+1
firebase_analytics: ^5.0.0
cloud_functions: ^0.6.0+1
firebase_storage: ^4.0.1
firebase_crashlytics: ^0.1.0+3
firebase_messaging: ^7.0.2
when trying to run it says to update the CocoaPods spec by running pod repo update, done that, but still got the same error, then running pod install or pod update got the error
tried the commands: pod install --repo-update and pod update Firebase/Storage but still got the same error message
Just remove old flutter installed folder like [.cache] / [pub-cache] because you might have upgraded the flutter version but iOStools and other tools are pointing to older version and it causes these architecture issue.
Finally after doing lot of changes, I found out that the culprit was the purchases_flutter: ^1.3.1 package.
When I remove the package from my yaml file then it starts working. There is a bug already opened for it https://github.com/RevenueCat/purchases-flutter/issues/120.
Thank you every one for your time and help.

Upgrading React-Native iOS can't find 'Bundle React Native Code And Images' in Xcode

I have recently upgraded my React-Native version from 0.61.0 to 0.61.2. I use Upgrade Helper.
Everything is working fine in android and ios simulator but when i give a release build in ios, it says that.
No bundle url found and crash iOS App.
Then i compare everything with my previous React-Native version and found that there is no 'Bundle React Native Code And Images' in Xcode root project Build Phase section.
#React-Native Version Info
CPU: (4) x64 Intel(R) Core(TM) i5-3470S CPU # 2.90GHz
Memory: 4.19 GB / 16.00 GB Shell: 3.2.57 - /bin/bash
Binaries: Node: 12.15.0 - /usr/local/bin/node
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs: iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
IDEs: Xcode: 11.5/11E608c - /usr/bin/xcodebuild
npmPackages: react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
npmGlobalPackages: react-native-cli: 2.0.1
Please someone help me to find out how can i solve this Problem?

Resources