Xcode build errors when running Cordova run command - ios

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.

Related

Issues building react native project in xcode with m1 chip

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

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

Build failing for 'ionic build ios' on OSX 10.12.1

So this is a brand new Mac Air.. running Sierra.
When i run
ionic build ios
i get
** BUILD FAILED **
The following build commands failed:
CompileC /Users/foo/Library/Developer/Xcode/DerivedData/homepocket-gtpsstxtfgknjdgahozlqhgfgmmi/Build/Intermediates/homepocket.build/Debug-iphonesimulator/homepocket.build/Objects-normal/x86_64/AppDelegate.o homepocket/Classes/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/foo/Library/Developer/Xcode/DerivedData/homepocket-gtpsstxtfgknjdgahozlqhgfgmmi/Build/Intermediates/homepocket.build/Debug-iphonesimulator/homepocket.build/Objects-normal/x86_64/MainViewController.o homepocket/Classes/MainViewController.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/foo/workspace/myproject_mobile/myproject/platforms/ios/cordova/build-debug.xcconfig,-workspace,myproject.xcworkspace,-scheme,myproject,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone 5s,build,CONFIGURATION_BUILD_DIR=/Users/foo/workspace/myproject_mobile/myproject/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/foo/workspace/myproject_mobile/myproject/platforms/ios/build/sharedpch
I installed latest xcode via apple store.
I set the machine to dev mode via xcode ide.
I've ran the emulate through xcode.
I can successfully 'ionic build android' as well as emulate.
I've also run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Because i was seeing
Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
.. mind you all of this is a fresh box from Apple.
After finding this.. https://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232/47
The solution for me was ...
ionic platform remove ios
ionic platform add ios#3.9.2
ionic prepare ios
Then i could build ios.

Ionic build on iOS returns "BUILD FAILED"

I'm working on Ionic on a Mac machine. I have installed Google Analytics plugin and trying to build project but it is not working.
I am getting following error:
** **BUILD FAILED** **
The following build commands failed:
..../path normal i386
(1 failure)
>Error: Error code 65 for command: xcodebuild with args:
-xcconfig,/Volumes/Workspace/Dev/TestApp/platforms/ios/cordova/build-debug.xcconfig,
-project,TestApp.xcodeproj,
-target,TestApp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,build,CONFIGURATION_BUILD_DIR=/Volumes/Workspace/Dev/TestApp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Volumes/Workspace/Dev/TestApp/platforms/ios/build/sharedpch
I have tried with platform removing and add adding but still not got fixed.
How can I solve this issue?
It was an issue due to xcode compatibility of plugin. uninstalling current xcode and installing xcode 7.3.1 solved issue.
Note: It is due to ionic build ios command internally uses xcode command to build project.

Build Commands Failed Error Code 65 Ionic (iOS)

I'm using ionic to build my iOS app but im having this problem when running the command : "ionic build ios"
** BUILD FAILED **
The following build commands failed:
CompileC build/HR\ APP.build/Debug-iphonesimulator/HR\ APP.build/Objects-normal/i386/PushPlugin.o HR\ APP/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/user/desktop/hr/platforms/ios/cordova/build-debug.xcconfig,-project,HR APP.xcodeproj,ARCHS=i386,-target,HR APP,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/user/desktop/hr/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/user/desktop/hr/platforms/ios/build/sharedpch
Try This command
phonegap plugin remove phonegap-plugin-push
I had this same issue,
I would like to let you know my machine local environment setup-
******************************************************
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
ios-deploy version: Not installed
ios-sim version: 5.0.8
OS: OS X Yosemite
Node Version: v6.2.2
Xcode version: Xcode 7.2 Build version 7C68
******************************************************
It generally occurs when we took app raw code form some other machine and try to build.
When I search for that I came to know that this issue is taking place due of spaces from build path
Steps I followed-
Opened app config.xml in editor.
Renamed App name such as-
<name>Rername App Title</name>
$ cordova plugin save
$ cordova platform rm ios
$ cordova platform add ios
After this I just build the app
$ ionic build ios
And that worked for me, hope you will get your issue resolved too.
This link helped me a lot-
https://forum.ionicframework.com/t/ionic-build-ios-fails-android-works/10515/2
Note:- Make sure you have complete icon and splash of the app for each platform i.e-
ionic resources

Resources