29
votes

random issue is happening

After updating my POD install, Xcode sprouted a new issue:

16

16 Answers

92
votes

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

19
votes

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

14
votes

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.

13
votes

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.

11
votes

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.

ss

6
votes

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

3
votes

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.

2
votes

Solved - Best Way

pod deintegrate  
pod install

Open xcworkspace and clean it before running.

1
votes

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.

1
votes

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

0
votes

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...

0
votes

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.

0
votes

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.

0
votes

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.

0
votes

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.

-4
votes

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.