Issues building react native project in xcode with m1 chip - ios

I am trying to build a react native project in xcode to ipad simulator
but I get this error in xcode
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
Command CompileSwiftSources failed with a nonzero exit code
I have seen this thread
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
Have tried everything but nothing is making any difference
The build settings were already set to incremental
I dont see anything useful under Compile swift source files above the error...
It starts out as below, (there is more to it but nothing that is very human readable)
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'ExpoModulesCore' from project 'Pods')
cd /Users/alex/Documents/Projects/AtlasProject/src/frontend/packages/mobile/ios/Pods
export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer
export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name ExpoModulesCore -Onone -whole-module-optimization
If I run yarn ios which I believe runs react-native run-ios I get this error
We ran "xcodebuild" command but it exited with error code 70
I am using:
macOs 12.4
Chip Apple M1 Pro
Xcode 13.4
react-native: 0.67.1
pod 1.11.3
node 15.6.0
ruby 2.6.8p205
I tried downgrading xcode previously which did not help,
And a co worker of mine is capable of creating ipad builds on his m1 mac with xcode 13.4,
unfortunately they do not know why it isnt working on my mac
I am also getting additional errors relating to react-native-webrtc, all of which are basically just file not found

Related

PhaseScriptExecution failed when trying to run React Native app

I am a newcomer when it comes to React Native. However, when I tried to follow the steps that React Native provided: Environment Setup (I chose to use React Native CLI, Mac and iOS). Everything went fine until I tried to run the command
npx react-native run-ios
This is the error log that I received in the Terminal:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/phillip/Library/Developer/Xcode/DerivedData/myproject-csoqwegnbwhthjczvzcjwqasamef/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-46EB2E00018F30.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
I am using a MacBook Air with
M1 chip
MacOS Monterey
Xcode Version 14.2
node v19.6.0
Metro v0.73.7
I searched for a bunch of solutions, including the node versions, nvm, uninstalling build folder and use pod install, commenting post_install function inside Podfile file, but nothing works so far. I am using Node v19.6.0 and this is my which node output: /Users/username/.nvm/versions/node/v19.6.0/bin/node.
I also tried solutions from this reference: React Native - FBReactNativeSpec Command PhaseScriptExecution failed with a nonzero exit code but nothing has worked
Any help would be appreciated, thank you.

react-native build failing due to PhaseScriptExecution error

Environment
Mac OS X Version 12.1 (Apple M1 chip)
Xcode Version 13.2.1
Simulator Version 13.2 (972.2)
react-native-cli 7.0.3
node v18.4.0
The Issue
This is my first time working on developing an app using React Native. I am trying to run my React Native project on Xcode's simulator, using npx react-native run-ios. However, I am encountering this error message.
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening MCompass.xcworkspace.
Command line invocation:
/Users/brx/Downloads/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MCompass.xcworkspace -configuration Debug -scheme MCompass -destination id=DC3C75E6-19FD-4B80-87B1-62BF6404ED20
...
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/brx/src/projects/test/MCompass/ios/build/MCompass.build/Debug-iphonesimulator/MCompass.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'MCompass' from project 'MCompass')
(1 failure)
Between the first error message and ** BUILD FAILED **, there were many lines of output listing exports.
I've installed dependencies using both yarn and npm. I've also looked at several other threads with this same issue, but none of the solutions (such as having only one version of nvm or running react-native upgrade) have been successful. Does anyone have any tips?
I had my root folder name "REACT NATIVE", changing it to "REACT_NATIVE" fixed the error as the folder that contains your react native project cannot contain white spaces.
The second solution would be running Xcode with rosetta. This is only applicable for M1 chip macbooks as there are few times Xcode projects fail because of this reason. Please refer to below link for reference:
https://penny-huang.medium.com/xcode-how-to-run-ios-simulator-on-m1-mac-66101b9fccd8

Xcode fails to build flutter code for ios 13.3.1 device but runs code on 13.3 ios simulator

below is what I am getting on Xcode 11.3.1 and ios 13.3.1. what shall I do?
the code works on the ios simulator and builds for it is always successful. so where is the issue? what's wrong here, or am I missing some thing here?
I did try the clear / install pods method but nothing has been working for me.
iMac:x me$ flutter build ios
The plugin `device_id` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have undefined
behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
Building com.x.demo for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: MHUCCU5SX2
Running pod install... 5.9s
Running Xcode build...
├─Building Dart code... 61.5s
├─Generating dSYM file... 1.0s
├─Stripping debug symbols... 0.9s
├─Assembling Flutter resources... 1.9s
└─Compiling, linking and signing... 20.5s
Xcode build done. 239.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
The plugin `device_id` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have
undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
Building AOT snapshot in release mode (ios-release)...
Building App.framework for arm64...
Building App.framework for armv7...
Building AOT snapshot in release mode (ios-release)... 60.1s
Built to build/aot/.
warning: parsing line table prologue at offset 0x6f697463 found unsupported version 0x00
warning: line table parameters mismatch. Cannot emit.
note: while processing /Users/me/AndroidStudioProjects/x/build/aot/armv7/snapshot_assembly.o
The plugin `device_id` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have
undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
Project /Users/me/AndroidStudioProjects/x built and packaged successfully.
ld: warning: ignoring file /Users/me/AndroidStudioProjects/x/ios/Flutter/App.framework/App, building for iOS-armv7 but
attempting to link with file built for iOS Simulator-x86_64
ld: warning: ignoring file /Users/me/AndroidStudioProjects/x/ios/Flutter/App.framework/App, building for iOS-arm64 but
attempting to link with file built for iOS Simulator-x86_64
error: the following command failed with exit code 0 but produced no further output
Ld
/Users/me/Library/Developer/Xcode/DerivedData/Runner-axlithrrzxajtgfxqkefalkhujgj/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/Objec
ts-normal/arm64/Binary/Runner normal arm64
/* com.apple.actool.document.warnings */
/Users/me/AndroidStudioProjects/x/ios/Runner/Assets.xcassets:./AppIcon.appiconset/(null)[2d][Icon-App-50x50#1x.png]: warning:
The app icon set "AppIcon" has 6 unassigned children.
/Users/me/AndroidStudioProjects/x/ios/Runner/Assets.xcassets:./AppIcon.appiconset/(null)[2d][Icon-App-50x50#1x.png]: warning:
The app icon set "AppIcon" has 6 unassigned children.
/* com.apple.actool.compilation-results */
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20#2x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20#3x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29#2x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29#3x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40#2x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40#3x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon60x60#2x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon60x60#3x.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20#2x~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29#2x~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40#2x~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon76x76~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon76x76#2x~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon83.5x83.5#2x~ipad.png
/Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/Assets.car
/Users/me/Library/Developer/Xcode/DerivedData/Runner-axlithrrzxajtgfxqkefalkhujgj/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/asset
catalog_generated_info.plist
Non-fat binary /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/App is not
armv7. Running lipo -info:
Non-fat file: /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/App is
architecture: x86_64
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
This is a known issue with iOS 13.3.1 signing. It has no solution at this point in time. Current options include:
Use simulated device (rather than physical iPhone)
Use device with older iOS version
Use paid developer account (not personal team)
See this discussion that has up to date info:
https://github.com/flutter/flutter/issues/49504
For me the solution was to move to legacy mode buildfromNew Build` and everything worked properly !
It has been confirmed that the issue is fixed in iOS 13.4 beta 3 (17E5241d) release.

Xcode build errors when running Cordova run command

I am using the latest version of Cordova 6.4.0 to build an application on the iPhone (using Xcode obviously).
When I run the cordova run command to build the app I get the following errors in the terminal.
<unknown>:0: error: failed to import bridging header
'/Users/development/abc/mobapp/platforms/ios/abchq/Bridging-Header.h
** ARCHIVE FAILED **
The following build commands failed:
CompileSwiftSources normal arm64 com.apple.xcode.tools.xwift.compiler
CompileSwift normal arm64 /Users/development/abc/mobapp/platforms/ios/QuickPost/NetworkTableViewController.swift
CompileSwift normal arm64 /Users/development/abc/mobapp/platforms/ios/QuickPost/ShareViewController.swift
(3 failures)
Error: Error code 65 for command: xcodebuild with args:- xcconfig...... (a lot more info)
Can anyone suggest what could the cause of all of this - when I run this on the same machine for the Android it runs fine?? Any ideas?
My machine information is as follows:
Cordova CLI : 6.4.0
ios-deploy version : 1.9.1
ios-sim version: 5.0.13
OS : macOS Sierra
Node version : v7.1.0
Xcode version : Xcode 8.2.1 Build version 8C1002
The "Objective-C Bridging Header" setting (aka SWIFT_OBJC_BRIDGING_HEADER) must be set at the Target level, and NOT the Project level. Be sure to delete the setting value at the Project level. This should resolve the issue.
Check out this SO post for more info on this.

Error building app for ios in phonegap (for android is working fine)

I am developing an app with phonegap and I have always been testing the app using the android simulator and I have not had any problems, but I can not get it to work for iOS.
I'm working on a Mac OS mavericks and have installed Xcode.
When I run the command "phonegap run ios", I get the following:
[phonegap] detecting iOS SDK environment...
[phonegap] using the local environment
[phonegap] compiling iOS...
Build settings from command line:
ARCHS = i386
CONFIGURATION_BUILD_DIR = /Users/usuario/Desktop/desarrolloapp/nombreapp/platforms/ios/build/emulator
SDKROOT = iphonesimulator7.1
VALID_ARCHS = i386
xcodebuild: error: The project ‘NombreApp.xcodeproj’ does not contain a target named ‘NombreApp’.
[error] /Users/usuario/Desktop/desarrolloapp/nombreapp/platforms/ios/cordova/build: Command failed with exit code 65
Any idea about what's going on?
EDIT: I solve this doing:
Remove ios folder from platforms.
Run again (phonegap run ios).
Install ios-sim with command sudo npm install -g ios-sim.
All worked fine!
A lot of thanks.
Best regards.
Manually create target with name NombreApp in Xcode as given this link :
->
How to create or define a new target in a custom Xcode project template
Regards,

Resources