Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 531
Ennio Avatar asked Mar 31 '17 19:03

Ennio


4 Answers

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

like image 87
Lucas Moulin Avatar answered Nov 12 '22 08:11

Lucas Moulin


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 [email protected], 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

like image 9
2xSamurai Avatar answered Nov 12 '22 07:11

2xSamurai


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

like image 8
Aaron Furtado Avatar answered Nov 12 '22 07:11

Aaron Furtado


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 [email protected]
ionic cordova platform

Last step is used to check if [email protected] is actually the installed version.

Hope it helps.

like image 2
Rochadsouza Avatar answered Nov 12 '22 08:11

Rochadsouza