project run in iOS simulator, but did not build project in react native - xcode

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'Flipper' from project 'Pods')
** BUILD FAILED **
The following build commands failed:
Ld /Users/ramprasadsarkar/Library/Developer/Xcode/DerivedData/AwesomeProject-edxfscsdfjwsmicnfanfokvrokke/Build/Intermediates.noindex/AwesomeProject.build/Release-iphonesimulator/AwesomeProject.build/Objects-normal/arm64/Binary/AwesomeProject normal arm64

Please try the following.
If you are using terminal then set directory to your app folder.
or if you are using Vscode just open the terminal.
I hope you have already installed node.(did basic setup).
In terminal add follwing commands one by one, means use next commands only after completing 1 st command run.
npm install
cd ios
pod install
cd ..
npm run ios or npx react-native run-ios
Just check it works.

Related

XCode 14.0.1 error build: Command PhaseScriptExecution failed with a nonzero exit code (React Native project)

I'm trying to run my React Native project on XCode so that I can get it to run on my iOS device, everything works perfectly fine in VS Code and the Simulator software, but XCode simply refuses to build the project, throwing the error:
error build: Command PhaseScriptExecution failed with a nonzero exit code
This error occurs even when I try running an untouched new project (the example init project from react-native).
I tried these solutions:
deintegrating and reinstalling pods
running this command: npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle
Locking and unlocking the "login" keychain, I wasn't able to lock the keychain in the first place, the option is greyed out. What could cause that?
run pod install in the ios directory
I use:
XCode 14.0.1
M1 Macbook Air
MacOS Big Sur 12.6
React Native 9.1.3 (at least that's what npx react-native -v says, but node modules -> react-native -> package.json in my project says it's 0.70.1)
If there are any more details you need please let me know, thanks.
EDIT: Here's a screenshot of the build's report in the report navigator
screenshot

react-native run-ios fails to build

I have an existing project, that have been tested on an windows + android setup. Now I'm trying to run it on a macbook to test on an Iphone 11 simulator.
react-native-cli: 2.0.1
react-native: 0.64.0
I install the pod file and try to run
react-native run-ios
I get a the following error:
** BUILD FAILED **
The following build commands failed:
CompileC [USER]/Library/Developer/Xcode/DerivedData/andon-hkuetryxdipcrgbcxnseaqnfnaqp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o [PROJECT_PATH]/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
I encountered this problem while running a React Native iOS app on macOS. After researching the issue for hours I was able to resolve it with these steps:
Clear the cache of pod by running these commands:
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
Navigate to the ios directory, and delete the Pods directory
While still in the ios directory, run pod install
Navigate back to the project directory, and run npx react-native run-ios
Hope this helps you too!
Probably very late to answer.
I started facing this issue after I upgraded from 0.63.4 to 0.64.2.
If we run from command line was not getting any way to find out the error. When I ran from x-code, found following error message,
/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm:172:8: 'shared_timed_mutex' is unavailable: introduced in iOS 10.0
The reason for that was the following entry in my podfile,
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
After I deleted the above entry it started working like a charm.
ref: https://github.com/facebook/react-native/issues/31250#issuecomment-808312355
Under XCode top menu, Goto XCode->Preferences -> Locations -> Open
Derived Data folder(By clicking the arrow button) (Find screenshot
for your references)
Finder will open Derived Data folder,
Delete Derived Data Folder
Start Metro server using npm start or yarn start
Perform Clean build using cmd+shift+k
Run the application using cmd+r

Flutter Apple silicon fatal Shared_preferences error: 'Flutter/Flutter.h' file not found

I am using an Apple Silicon mac for my Flutter project and I have an issue after passing my program to my new computer.
Xcode's output:
↳
In file included from /Users/gorkem/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users/gorkem/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
error: the following command failed with exit code 1 but produced no further output
CompileC /Users/gorkem/Library/Developer/Xcode/DerivedData/Runner-ghjviwzylhbejhfsayqxcrbfzwyc/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/local_auth.build/Objects-normal/x86_64/FLTLocalAuthPlugin.o /Users/gorkem/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/local_auth-0.6.3+4/ios/Classes/FLTLocalAuthPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'shared_preferences' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'vibration' from project 'Pods')
I think that the problem comes from the file flutter.h inside the shared preferences package.
Here's one of the part of the problem. If you need more, I can edit it anytime.
I already did many things related to this issue but apparently, it didn't work. If you have a recommendation, I'l listen to it.
BTW, I tried flutter clean and then rerun, tried to update all the packages. None of them work.
Try removing CocoaPod from your project
cd ios
pod deintegrate
flutter clean
flutter run
If this doesn't work try reinstalling flutter or switch to beta channel

Nativescript Tutorial: error with livesync

I'm running on macosx with nativscript 2.0 (typescript+angular2 tutorial).
I just ran the tns run ios --emulator command and then ctrl-c.
Then running this command: tns livesync ios --emulator --watch
results in:
.
.
.
Transferring project files...
Successfully transferred all project files.
Applying changes...
**Error Command failed: killall sampleGroceries2.app
No matching processes belonging to you were found
while executing killall sampleGroceries2.app.**
I have tested the {N} + Angular2 tutorial and afer following the instruction I had no problems with the livesync option.
Have you updated to NativeScript 2.0.0 - I have noticed that this error was logged in the previous version 1.7.1.
If you need to update your NativeScript version globally you can run
npm install -g nativescript
After that step you can remove/add the platform folder from your project with the following commands
tns platform remove ios
tns platform add ios
Also delete the node_modules folder and the re-run
tns run ios --emulator
To check your current NativeScript version you can execute
tns --version
The latest official release of {N} has some livesync fixes so now your command should run as espected - let us know if that solution was appliable for your case.

xcode build fails with error code 65 without indicative message

I'm experiencing weird behaviour with my iPhone CI job (running in TeamCity). Every once in a while our build fails without any indicative error in the build log. The build reaches the last stage of codesign validation and I get ** BUILD FAILED ** message immediately after.
These are the last lines of the log of a good and bad builds -
Bad Build
[15:00:56] : [CodeSign] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Library/TeamCity/buildAgent/work/dc055fa257f562be/DerivedData/MyProject/Build/Products/AdHoc-iphoneos/MyProject.app
[15:00:58]W: [Step 3/6] ** BUILD FAILED **
Good Build
[14:09:13] : [CodeSign] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Library/TeamCity/buildAgent/work/dc055fa257f562be/DerivedData/MyProject/Build/Products/AdHoc-iphoneos/MyProject.app
[14:09:13] : [Step 3/6] ** BUILD SUCCEEDED **
Because it's running in a CI I looked for user interaction problems (opening the keychain...etc') but usually xcodebuild spews the relevant errors.
Is there any other log I can dig into to find the cause of the build failures?
EDIT:
Seems I had the same problem like build failed jenkins iOS no error.
I also had a similar problem, in my case it was caused by the fact I'm using both Xcode 7.2 and Xcode 6.4 side by side. When the simulator of Xcode 6.4 is open (iOS Simulator 8.4) and I try to start a test from the commandline using Xcode 7.2 I get this 65 error.
Eg. when iOS Simulator 8.4 is open:
# sudo xcode-select -s "/Applications/Xcode 7.2.app/Contents/Developer"
# xcodebuild test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -workspace "/path/to/MyWorkspace.xcworkspace" -scheme "MyProject" -destination "platform=iOS Simulator,name=iPhone 6,OS=9.2"
(cut)
** TEST FAILED **
# echo $?
65
Solution is to kill the simulator before starting the test:
# killall "iOS Simulator"
# killall "Simulator"
The process is called "iOS Simulator" for XCode 6.4 and earlier and called "Simulator" for later XCode versions.
Had the same problem as build failed jenkins iOS no error
tl;dr - CopyPNG failed because of two images with the same name.
You need to remove platform ios - cordova platform rm ios, and then add platform - cordova platform add ios. now build ios - cordova build ios
I hit this when updating to Xcode 8, in my case it was because I had set the PROVISIONING_PROFILE_SPECIFIER setting incorrectly
For Xcode version 13
The following is what worked for me, this is aimed at Xcode version 13, hoping to be helpful
My React native project was cloned, i was able to run the app in android, but while running on iOS it showed error code 65.
After trying most of the solutions and failing, i got it fixed finally. This is what worked for me, and could be useful for some people hopefully.
Clone the project again(not necessary, just telling you what was done)
npm install
pod install (in iOS directory)
If Xcode shows error code 65, if there is legacy deprecation issue --> go to Xcode -->file --> workspace settings --> Check the box at the end of the window saying "do not show diagnostic issue about build system deprecation
run the project again
This is what fixed it for me.
My issue came up after updating to the latest version of Xcode. To resolve, I performed the following steps.
Completely quit Xcode and the Simulator. I had a zombie Simulator process running that I found and closed through Activity Monitor. Be sure no processes for Xcode or Simulator are running.
In Xcode, open the project found in the ios folder of your react-native project.
Xcode may suggest some recommended updates to modules. I accepted their recommendations.
Close Xcode, relaunch your react-native app

Resources