Apple Mach -O Linker command failed

妖精的绣舞 提交于 2019-12-01 02:41:02
blackops

Make sure you open the .xcworkspace file rather than the project file (.xcodeproj) when working with pods. That should solve the issue with linking.

Some times you need just clean build. It helped me. To clean build go Product -> Clean

There are several cases that cause this issue. At the moment, this question has no any accepted answer and also I found another solution for the same issue, I am posting my answer/experience here.

In you application, go to Target -> Build Settings, then you will find following attributes.

  • CLANG_WARN_INFINITE_RECURSION
  • CLANG_WARN_SUSPICIOUS_MOVE
  • GCC_NO_COMMON_BLOCKS

Set values for those as NO, then clean and build the project.

Following steps helped me to get rid of this problem:

  1. Go to project path and remove Pods folder and Podfile.lock file.
  2. Reinstall pods again using "pod install" command.
  3. Open xcworkspace and clean it before running.

Hope it will save someone's time like it did for me.

Close you project and go to project path and select your project with .xcworkspace instead of .xcodeproj. Reason your existing project doesn't contain any library you linked.

Remove the local files of WikitudeSDK from target. Xcode is getting confused between the paths of library, which one to chose- pod or local.

Also try reinstalling podfile and remove wikitude from pod file to. IN linker search path settings, in build settings, check the paths mentioned to find the required library.

Lastly install gems before updating pods

You have to check Link Binary With Libraries option. Sometimes you build pod that is not in your project anymore.

On the left panel click on your project name, then under Targets again (click on name), then Build Phases > Link Binary With Files. Delete everything that you dont use.

Solved - Best Way

pod deintegrate  
pod install

Open xcworkspace and clean it before running.

I got same error like duplication of "variable name". You need to check all variable and function name for all .m file and make sure it's not same in any other file.Then clean and build.

It's working for me.

the solution for me was open the .xcworkspace file insted of .xcodeproj located inside my '/platforms/ios' folder.

I had a similar problem and I just had to make sure to enable the "copy if necessary" checkbox when adding the framework into the project. Reference only didn't work for me...

I have no clue why the error occurred in my case, I was reusing some code from another project I created a while ago and after I adapted the code, then I always got the "Apple Mach -O Linker command failed"- Message. My best guess is, that it happened because I created/deleted some files from the project.

The thing that solved it for me was this:

  • Create a new Project
  • copy all the necessary files from the old project to the new one (Drag and Drop, don't forget the "Copy if needed" Checkbox)
  • Build and see that it works

Sounds stupid and I have no idea why, but it worked.

I am using XCode for compiling ionic 3 app.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.10.1
    ionic (Ionic CLI) : 3.10.1

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3 ios 4.5.0
    Ionic Framework    : ionic-angular 3.6.0

System:

    ios-sim : 5.0.8 
    Node    : v8.4.0
    npm     : 5.4.0 
    OS      : OS X Yosemite
    Xcode   : Xcode 7.2 Build version 7C68 

There was not write permission in most of the file of ios, which was main issue.
I just changed the permission of ios file and got issue resolved by using command.

sudo chmod -R 775 platforms/ios/ 

Worked great.

I experienced the error when overwriting project.

Still encountered the error after:

Error was solved after changing to a different branch in github but perhaps one of the other troubleshooting methods played a part. Now all branches run on xcode without the Mach -O Linker Error.

I had faced the same issue. I declared two classes with same name. Therefore it was conflicting with the class name. It worked for me after updation of class name.

mistdon

First thing you have to do is to delete the files in /Users/Yourname/Library/Developer/Xcode/DerivedData/YourAppName-xxxx and then restart your Xcode. That is no joke!

If you got an error like "duplicate symbol_OBJC_CLASS_$_Pod in:", you should go to TARGETS->Build Phases->Compile Sources and delete extra file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!