How to fix ionic 2 Apple Mach-O Linker error? - ios

I'm building an ionic 2 app, and I can build the app with ionic build ios and I get no erros, but on xcode when I build my application I get the following error.
Apple Mach-O Linker (id) Error
Linker command failed with exit code 1 (use -v to see invocation).
How can I fix this?
Here is my system information
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.0
OS: macOS Sierra
Node Version: v6.9.4
Xcode Version: Xcode 8.3 Build version 8E162

You are probably opening the .xcodeproj on Xcode, try opening the .xcworkspace. This fixed this error for me.

Had the same issue, spent almost a day trying to figure out what was causing it. For me the following solved it. Everything was working fine on ios#4.3.1, but on 4.5.3, I got this annoying error.
Check if this plugin "cordova-plugin-console" is there in the plugins folder. If it is there, remove it. Then it started building without any errors.
ionic cordova plugin remove cordova-plugin-console

Look for a file named libPods-AppName.a in Frameworks directory
where AppName is your app name.
Deleting it fixes it in most cases.
Take a look at the screenshot for reference.
Quick Fix

Disclaimer: My project uses Ionic v1
I had the same error and, once I had added a Android-only plugin, I thought that it was the cause of the error - I was wrong (so, ignore this cause if you think the same as I).
After some search I found the truly cause of the error: the cordova-ios version (4.5). I followed the steps suggested here and I solve this issue.
Steps:
ionic cordova platform remove ios
ionic cordova platform add ios#4.4.0
ionic cordova platform
Last step is used to check if ios#4.4.0 is actually the installed version.
Hope it helps.

In your platforms folder for ios, there are both .xcodeproj and .xcworkspace files. Open the /platforms/ios/.xcworkspace.

I found the issue that was causing this error.
On the config.xml file on the tag I had the email with my#email.com and you cannot have the .com on the email. I removed and it works fine now.
Thanks for the help

Related

IONIC 5 - InAppBrowser is not installed or you are running on a browser -XCODE 13

I have an IONIC 5 / cordova project and I use InAppBrowser to open a link.
In the next code:
const browser = this.iab.create(url);
I get error "WARN: InAppBrowser is not installed or you are running on a browser. Falling back to window.open" on execution time in IOS device and IOS emulator.
I have tried all kinds of things that I have found on the internet:
First, I have done many test with #ionic-native/in-app-browser plugin, but I always get the same result:
Remove node_modules, www, platform/ios
Re-install(remove and install) in-app-browser libraries
Recompile in dev and prod mode.
Same error..
I have tried it again with the new plugin:
$ ionic cordova plugin add cordova-plugin-inappbrowser
$ npm install #awesome-cordova-plugins/in-app-browser
I change the code to get the new native plugin
$ ionic cordova platform add ios
BUILD DEVEL and PROD
$ ionic cordova build ios
$ ionic cordova build ios --prod
Same result.
I have verified that the cordova plugins are installed in the /Plugins folder of the XCode project.
I have a couple of things to comment on:
Now I use XCode 13, but In XCode 12 works fine. To upgrade the XCode I have upgrade MacOS from Catalina To Monterey.
The only difference between the two projects is that in XCode 13 "Legacy build system" is disabled since it's "deprecated".
I don't know if XCode doesn't import the libraries, I don't know if "Legacy Build System" is necessary. I know nothing... :-(
Can anybody help me?
Thanks.
I found the problem.
In my project I have an "Object.prototype" function that it produce a big problem to loop objects.
Referring InAppBrowser pluguin, in file inappbrowser.js:
callbacks = callbacks || {};
for (var callbackName in callbacks) {
iab.addEventListener(callbackName, callbacks[callbackName]);
}
Perhaps it could be improved with an Object.keys(callbacks), but I think that It was my problem.
Thanks.

Ionic "Seems to be a very old project file format - please open your project file in a more recent version of Xcode"

fastlane finished with errors relating to automatic_code_signing. I’m not sure what this means and how to fix it, but it’s an error I hadn’t gotten before. I’m on Ionic v3
This has to do with the iOS platform not being up to date.
iOS builds including cordova-ios v4.5.5 or earlier will fail with this error in Appflow. This issue was corrected in cordova-ios v5.0.0. Updating to a current cordova-ios release will resolve the problem.
To remove and reinstall the iOS platform:
ionic cordova platform rm ios
ionic cordova platform add ios#5.1.1 //the latest release of the current major version is recommended.
This
example specifies the latest version at the time of writing
Source here

xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH - Since updating Xcode

Updated Xcode this morning and now ionic project wont deploy to a device.
ionic run ios --device
Returns:
** BUILD SUCCEEDED **
xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
Error: Error code 72 for command: xcrun with args: -sdk,iphoneos,PackageApplication,-v
No idea what to do to fix, Googling returns lots of options but none correct.
Cordova is trying to use "PackageApplication" tool. But it was removed since Xcode 8.3. Either downgrade Xcode or wait for Cordova to have a fix for that.
Linked in the Jenkins issue that matson kepson mentioned here there was a guy who attempted a PR to fix the issue. There was some unfinished change requests in his PR and I also found a few null ptrs in his changes. I forked his pr and fixed these things here and there is now a snapshot linked here that you can download and become unblocked until such a change is merged into the full build.
Hi its official Bug from jenkins
here you have a fresh status
https://issues.jenkins-ci.org/browse/JENKINS-43163
Little bit clearer to look at this:
http://subathrathanabalan.com/2016/01/07/building-ipa-export-archive/
I've just come across this and my solution was to remove the iOS platform from the project:
ionic platform rm ios
Then add it back in again
ionic platform add ios
I needed to run an initial build for it to fail with no signing set, so opening up the project in Xcode to just fix that. After that, building via the ionic cli worked as expected. I am guessing that re-adding the platform pulled in a new version of cordova-ios.
Update: I had only started on this project and created the base project from the blank template. I have Xcode 8.3.1 installed and using Ionic 3 (still with the --v2 switch with ionic cli).
I used shenzhen this automatic procedure encountered a similar problem, and finally in accordance with the github Pull Request to solve my problem, hope for your reference!
https://github.com/nomad/shenzhen/pull/347
I found a workaround to solve this using command line, with device connected on your mac:
ionic build ios --device
ios-deploy --noninteractive --debug --bundle build/device/YOURAPP.app
After this, stop debug using Ctrl C, and your app will be working on your device.
Hope work for you guys.
The is caused by the deprecated PackageApplication. If you're using the remotebuild tool to run from Windows, it will be solved when the remotebuild bug has been fixed: https://github.com/Microsoft/remotebuild/issues/26
Another solution is to downgrade XCode.
Here if the explanation on how to uninstall current XCode.
And here you can download XCode 8.2.
An option is open a .xcodeproj file located at platforms/ios and run the project directly from Xcode.

Cordova 6.1.1 iOS build fail with error code 65

I am new to Cordova using Mac OS and I am just running the Mac OS in virtual machine.
Any help will be greatly appreciated.
When I build a project for iOS platform the build fail due to this error.
The plugin only installed is whitelist which require in new version of cordova.
Additional information may need:
- I am using Yosemite hackintosh.
- Cordova v.6.1.1.
- xcode 6.4
Thank you!
What's the version of your plugin of cordova-plugin-camera?
I sugest you
update Xcode from 6.4 to 7.0;
remove your dir, and create a Cordova project again.
then you can try "cordova build ios" again.
As you have installed only cordova whitelist plugin, this could not be a plugin issue. You can create a new project and port your code and try building iOS platform again. This solves the issue in most cases. Also ensure that you dont have any illegal or special characters in config.xml. Many a times, copy paste results in special characters addition in config.xml which causes this issue.

Determining cause of cordova iOS build failure

My cordova phone application is building and running well in android, and now I'd like to build for ios. I can't do this in my linux environment, so I'm using a mini-mac with the Xcode tools installed.
I cloned the git repo to a working tree, and I'm running
cordova build ios
In the build output, I'm getting the following, with "fatal error", "BUILD FAILED" and "Error: ..." in red.
/Users/mgfrobozz/Desktop/asap_cordova/platforms/ios/ASAP Media/Plugins/org.apache.cordova.dialogs/CDVNotification.m:21:9: fatal error:
'Cordova/NSDictionary+Extensions.h' file not found
I found https://issues.apache.org/jira/browse/CB-8659, which indicated this issue (deprecated dependency in ios) was resolved in cordova 4.0.0, but I'm running cordova 6.0.0.
I don't know enough about the cordova guts to know how to fix CDVNotification.
Any suggestions?
Try the command: cordova platform update ios

Resources