41

I am trying to clone a project from a bitbucket repository and am getting an error Id: framework not found Pods clang: error: linker command failed with exit code 1 (use -v to see invocation) when trying to run an Xcode project in workspace. These are the steps I have followed, if anyone could let me know what I am doing wrong, that would be great!

  1. git clone (link to bitbucket)
  2. changed the configuration settings in the Xcode pods project to none for both debug and release
  3. performed pod install
  4. opened Xcode workspace file
  5. tried to build in Xcode and received the error Id: framework not found Pods clang: error: linker command failed with exit code 1 (use -v to see invocation)

Edit Here is the podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'

target 'Oncarb' do
  pod 'Alamofire'
  pod 'SwiftyJSON', '~> 2.2.0'
end

#target 'OncarbTests' do
#  pod 'Alamofire'
#  pod 'SwiftlyJSON', '~> 2.2.0'
#end

Is there a step I am missing?

Thank you!

4
  • You must use cocoapods
    – webo80
    Jun 30, 2015 at 13:30
  • Have you added the pod frameworks to the Embedded binaries ? It's often necessary if you want to build on a real device
    – Dean
    Jun 30, 2015 at 13:37
  • @Pami -- could you post your Podfile as well? Jun 30, 2015 at 13:48
  • @Dean I just added the pod frameworks to the Embedded Binaries - they weren't there to start, but unfortunately I am still getting the same error when I try to build. Any other suggestions?
    – Pami
    Jun 30, 2015 at 14:20

5 Answers 5

140

This has fixed it for me:

  1. Open up the workspace.
  2. Click on the blue project icon (that expands into your file tree) on the left hand side of the screen
  3. Just to the right, select "Targets" (as opposed to "Project"--Project is blue, Target is like a pencil and a ruler and a paintbrush making a triangle)
  4. Click on the General tab
  5. Go to the "Linked Frameworks and Libraries" section (all the way at the bottom)
  6. Delete the Pods frameworks
  7. Add Alamofire and SwiftyJSON

In my case, it didn't work unless I removed the pods frameworks, but I get the feeling that this is a workaround. Perhaps someone with more experience can comment.

5
  • 2
    Worked for me as well after deleting Pods frameworks, closing Xcode, running pod update, then Clean/Build. Oct 5, 2015 at 20:34
  • 1
    There are so many other wrong answers to this >.> Thanks for breaking down the steps!
    – Decoded
    Mar 1, 2016 at 16:30
  • 1
    Removing "Pod.framework" from "Embedded Binaries" worked for me
    – DTHENG
    Apr 26, 2016 at 17:35
  • 2
    Thanks for the solution. This happened to me after I upgraded cocoa pods to 1.0
    – ArdenDev
    Nov 13, 2016 at 16:11
  • 1
    another solution could be; $ pod deintegrate && rm Podfile.lock && pod install
    – yasirmturk
    Jan 7, 2019 at 5:37
31

Sometimes after renaming a target or moving something, you can corrupt your pods installation. Luckily, there's an easier way to fix it than sudo make install's solution.

  1. Run pod deintegrate to remove any trace of Cocoapods from your project.
  2. Run pod install again to add it all back.

That's it, fixed.

2
  • This also worked when having issues with the Firebase pod and needing to use inherit! :complete in my test target
    – richy
    Jul 17, 2017 at 21:30
  • worked for me too after renaming my project, having to edit Podfile and changing my project name there too, and then adding Firebase and Crashlytics pod
    – nommer
    Jul 13, 2018 at 23:29
5

My issues is when i ran test i got this error. Because i just install it in my

target 'Project' do
   pod 'xxx'
end

You should also add it into your test target:

target 'ProjectTests' do
   pod 'xxx'
end
1
  • The test target can also be nested inside the other target, and will then inherit all those pods.
    – jscs
    Jun 8, 2017 at 19:55
1

In my case, I had several frameworks listed in red. These were left over from previous Podfile configurations. I simply removed these frameworks listed in red and the problem was fixed.

1

One possible cause in an explicit import of a Cocoapods framework into a test class / into the test target.

Example:

import XCTest
//import AlamofireImage
@testable import MyProject

// instead of importing AlamofireImage:
#if os(iOS) || os(tvOS) || os(watchOS)
    import UIKit
    public typealias Image = UIImage
#elseif os(macOS)
    import Cocoa
    public typealias Image = NSImage
#endif

I first imported AlamofireImage because I explicitly used typealias Image in my test as defined in AlamofireImage.

If it is as easy to prevent an import as in my example, do it. I just copied the definition of Image into my test class file.

If you think you really need that import, go on with the answer of William Hu. A footnote to his answer:

target 'MyProjectTests' do
   pod 'OnlyThatFrameworkYouImportIntoYourTest' 
end

You need to add only those pods to your test target, that you (need to) import explicitly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.