321

I'm trying to add a framework to my IOS project but when I build I always got the same message :

ld: framework not found Pods

clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried to remove my Pods directory and then run pod install I open the .xcworkspace like it is written in the logs on the pod install, I clean the project on xcode and then try to build but it won't works..

My podfile looks like this :

xcodeproj '/Users/guillaume/project/Mobile/iOS/FoodPin/FoodPin.xcodeproj'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'SwiftHTTP', '~> 0.9.2'

My version of xcode is 6.3.1

Thank you,

9
  • 3
    Did you check that libpods.a is in your "Linked Frameworks and Libraries" of your target ? And in your Build Phases too ? Commented Apr 25, 2015 at 17:04
  • Did you manage to solve this? I'm having the same error Commented Jul 1, 2015 at 15:06
  • @ChristopherFrancisco I solved it, check my answer.
    – Arbitur
    Commented Jul 24, 2015 at 10:20
  • 1
    This How to Answer[1] solved my problem! Hope it helps [1]: stackoverflow.com/a/31161871/1557663 Commented Sep 29, 2015 at 17:06
  • @MárioCarvalho Thats just a longer and more beginner-friendly version of my answer x)
    – Arbitur
    Commented Nov 27, 2015 at 13:51

48 Answers 48

572

In Project Navigator in the folder Pods I had a Pods.framework in there which was red. It was also present in Linked Frameworks and Libraries. I removed both references and the error disappeared.

TL;DR

Remove Pods.framework in:

  • Folder named Pods
  • Linked Frameworks and Libraries
12
  • 7
    I think I ended up with this problem after added use_frameworks! to my Podfile and subsequently commenting it out. Deleting the reference to Pods.framework fixed the issue.
    – stephent
    Commented Sep 8, 2015 at 16:33
  • 2
    @StephenT Yes I believe thats what I did too, first use use_frameworks! and then without and perhaps the Pods.framework wasn't deleted properly during pod install. Might be a bug in Cocoapods.
    – Arbitur
    Commented Nov 24, 2015 at 8:36
  • 4
    If this doesn't work, try using cocoapods-deintegrate. That just solved this problem for me.
    – nickdnk
    Commented May 28, 2016 at 15:00
  • 3
    After running pod install, I somehow ended up with a "Pods_<Project Name>".framework file in my Pods folder. Deleting this file, cleaning, and rebuilding removed this error for me. Commented Oct 17, 2016 at 17:10
  • 1
    I'm pretty sure this error occurred for me after adding several more pods to my project, then deciding to roll back by shelving the changes in Git. I have yet to resolve it using any of the methods I've found thus far – this thread included. Commented Mar 18, 2017 at 3:40
321

This is usually caused by having the .xcodeproj file open instead of .xcworkspace.

When you run 'pod install' for the first time, it will create an .xcworkspace file, which includes your original .xcodeproj and a Pods project. You'll need to close your .xcodeproj and open the .xcworkspace instead.

This is a common issue when creating a project through Xcode's new project wizard - I often forget that I'm not in a workspace, which is required to get Cocoapods to link correctly.

2
  • When done in combination with the answer by Arbitur, this resolves the issue. Thanks! Commented Sep 13, 2016 at 2:47
  • there is no .xcworkspace file inside my project. what to do
    – Kartiikeya
    Commented Mar 18, 2019 at 10:36
163

Xcode 9, 10, 11, 11.5

install https://github.com/CocoaPods/cocoapods-deintegrate

pod deintegrate

then

pod install
5
  • 2
    Worked like a charm! Thank you. This got rid of an old reference to a renamed target that was causing this error. Commented Mar 29, 2018 at 11:04
  • 1
    Wow You saved my day! was stuck from yesterday and finally solved with Xcode 10. Thanks! Commented Oct 5, 2018 at 4:52
  • 4
    This should be the correct answer, it's the safest approach. Don't do manual steps when using automated stuff like CocoaPods, unless it's a known bug that can't be fixed otherwise.
    – Gobe
    Commented Mar 26, 2019 at 16:44
  • Doesn't work for me. But Elliott Davies answer works.
    – Torben G
    Commented Oct 11, 2019 at 4:13
  • 2
    This was the only correct solution for me. Xcode 11.5 (11E608c). Thank you!
    – banana1
    Commented Jun 10, 2020 at 6:37
63

I cleared this error by deleting the red .framework files that were located in a folder Frameworks in the project navigator. I think this also automatically deleted corresponding red entries in the Linked Frameworks and Libraries section of the General settings.

I have been cleaning / reinstalling pods in order to fix another issue. Perhaps these red framework files and entries were just leftover from a previous pod install?

2
  • Yes! My issue was in Linked Frameworks and Libraries of the General settings and was difficult to find as it doesn't come up in a text search! Commented Mar 22, 2019 at 15:36
  • In my case the framework files weren't even red, but just grayed out. But deleting them seems to have fixed the problem!
    – Swindler
    Commented Jun 10, 2019 at 6:13
58

I had a similar issue as

framework not found Pods_OneSignalNotificationServiceExtension

It was resolved by removing the following. Go to target OneSignalNotificationServiceExtension > Build Phases > Link Binary with Libraries and deleting Pods_OneSignalNotificationServiceExtension.framework It should be empty here. Hope this helps. Cheers.

6
  • This fixed the issue for me. My particular situation is that I had an iOS target MyApp. Then I needed to create a second target and had MyAppFirst, MyAppSecond targets. Cocoapods was able to build what it needed (Pods_MyAppFirst, Pods_MyAppSecond) but it was also trying to link to Pods_MyApp which no longer existed. I want to point out that in the process of trying to fix I did throw away my workspace file and Pods folder to have them recreated from scratch when I performed a “pod -install” but that did not help.
    – xdeleon
    Commented Mar 15, 2018 at 20:12
  • @Sharukh Mastan Would you have any idea how to make this happen after a pod install? Every time I pod install, the Pods_OneSignalNotificationServiceExtension.framework comes back to haunt me in the linked frameworks and libraries of the OneSignalNotificationServiceExtension target.
    – Sethmr
    Commented Apr 25, 2019 at 19:06
  • @Sethmr Sadly, no. In my case, however, it doesn't always happen after a pod install, it's random. Commented Apr 30, 2019 at 8:26
  • @SharukhMastan My issue was opening the *.xcodeproj/*.xcworkspace over the *.xcworkspace with my vsts .yml automation script. I know better with a gui, but still getting used to the requirements in scripting land.
    – Sethmr
    Commented Apr 30, 2019 at 14:48
  • 1
    Thanks 01 Shahrukh! this is really helpful
    – rizzz86
    Commented Nov 9, 2021 at 8:57
43

For who find this issue. I am using NativeScript and got the same error.

That happen becouse I opened the file .xcodeproj, but we must open the project by the file .xcworkspace.

1
  • 1
    This is indeed true
    – Charles
    Commented Jul 21, 2022 at 10:09
34

This happened to me after updating my Podfile and doing a pod update.

For some reason, I had a "Pods_[ProjectName]".framework file appear under my project under 'Targets' > General > Linked Frameworks and Libraries.

Deleting this and then clean/rebuilding fixed the issue.

2
  • 2
    This happens when you switch project names and need to clear the old one out. +1
    – Babbz77
    Commented Oct 28, 2017 at 7:02
  • This worked for me. I didn't change project names, but added Swift to a long running Objective-C project.
    – Luffy
    Commented Dec 4, 2018 at 5:40
16

you should delete your project some file as this picture.

your should delete the pods.framework and pods mark red files

0
15

I was getting this error because i renamed my project and change the name of project in pod file too but my project was referring to old name which was not there and causing this error . I get rid of this by

pod deintegrate

followed by

pod install
2
  • Yes! I had the same problem when downgrading version from 12.0 to 9.0. The above worked after I'd modified the target version in my Podfile to match what was in the project.
    – bownie
    Commented Jun 11, 2019 at 14:51
  • Good Answer. Thank you.
    – whdals0
    Commented Jun 18, 2019 at 2:13
14

Just Remove your .framework from the list of "Your Project->General->Linked Framework & Libraries".

1
  • That was it, I had two after I renamed the project. Thanks!
    – Jimmy
    Commented Nov 1, 2017 at 17:28
12

It's happened to me because I changed the Deployment Target in General but forgot to change the Deployment Target in Pods > General. Change the deployment target

2
  • Fixed it for me as well, Xcode 11.2/Cocoapods 1.8.4. Irritating that the error message bears no resemblance to the root cause... Commented Nov 13, 2019 at 16:07
  • 1
    Fixed it for me - didn't have idea that I need to change this in both places. Thanks a ton!
    – hakazvaka
    Commented Feb 10, 2020 at 3:25
11

[Xcode 11.2.1]

For me it was different app target version in Podfile(platform :ios, '11.0') and in Xcode project file Xcode Deployment info.

It causing Archiving job fail in CI pipeline.

Matching both value fixed an issue! Hope this help anyone.

2
  • 1
    It did solve my problem too, I had extension and the extension deployment version was different. Thank you @Hemant
    – MBH
    Commented Oct 5, 2020 at 13:23
  • Same case, tried everything just this helped. Thank you Commented Jun 29, 2021 at 15:54
7

This issue was driving me crazy as it suddenly happened without doing any changes to the project. I've tried all suggested solutions in this thread (and other related) and none of them solved the problem.

The only thing that differed from my other projects (which compiled fine), was that this project name was containing an accent (a french accent, "é"). I've renamed the project and all related files, and it finally worked !

Maybe this is related to updating to Xcode 10, because this project was working well before...

EDIT : it also seems to failed when using a project with - in project name…

5
  • 1
    You saved my life Commented Nov 5, 2018 at 14:01
  • 1
    Saved my life too!
    – Dan
    Commented Nov 19, 2018 at 14:24
  • Any solution besides renaming the project?
    – anestis
    Commented Oct 15, 2019 at 9:45
  • @anestis I don't think so. To quickly rename the project, I suggest commands from this answer stackoverflow.com/a/48004237/4894980 which do a very great job!
    – AnthoPak
    Commented Oct 15, 2019 at 12:06
  • My life is saved.
    – Skoua
    Commented Apr 3, 2021 at 17:40
6

In my case I can build it on devices and simulator but has the same errors when archiving. To solve it, I have to

  • remove Pods.framework
  • make sure Pods-<project-name>.framework is embedded

You will find the settings in TARGETS-->Linked Frameworks and Libraries.

1
6

In my case, after comparing the difference between a branch I knew built correctly, I noticed this line in my Podfile:

platform :ios, '11.0'

I had inadvertently up'd my target version from 10 to 11 while my targets in Xcode remained set to 10. Reverting back to 10 solved my issue for me.

Ensure your target iOS versions are properly set.

0
5

Step 1

The first thing that you will need to do is remove the Podfile, Podfile.lock, the Pods folder, and the generated workspace.

Step 2

Next, in the .xcodeproj, remove the references to the Pods.xcconfig files and the libPods.a file.

Step 3

Within the Build Phases project tab, delete the Check Pods Manifest.lock section (open),Copy Pods Resources section (bottom) and Embed Pod Resources(bottom).

Step4

Remove Pods.framework.

The only thing you may want to do is include some of the libraries that you were using before. You can do this by simply draging whatever folders where in the pods folders into your project (I prefer to put them into my Supporting Files folder).

It worked for me.

1
  • Step 3 worked in my case, step 3 -> cmd+alt+shift+k.
    – ViruMax
    Commented Oct 5, 2018 at 8:25
5

Using Xcode 8.3 the accepted answer didn't work for me. I had tried many other solutions but @Elliott Davies answer is what fixed it for me. I'm adding a screenshot for clarity. For some reason, Xcode was trying to link previous podfile setups that no longer existed. All I had to do was delete the extra references and everything worked.Screenshot of Xcode Linked Frameworks and Libraries

5

You're more than likely trying to get the pods to work into you project right? The only way to do so is by creating a separate project that uses CocoaPods.

Close all work-spaces that you are using.

Next, make sure you have your Podfile completely ready to go.

In the command line, wherever your file is, type the command:

pod deintegrate

Then, install your pod agian.

pod install or pod update

Now you can use your project's new workspace to develop from. Look for a file called .workspace. Use that file!

Here is a guide on using CocoaPods

1
  • Only this one worked for me after struggle of 2 days with the error. Commented Jan 11, 2018 at 9:05
5

This is the way i fix my problem. and it now work when i writing this answer:

Firstly, i try all the most fix way above,

remove Pods_xxx.framework from the link libraries and framework in target's build phases is helpful, and the issue will disappear, but the coming problem is i can't import the Pods.framework anymore.

And Then, i try to reinit the xcworkspace config, so that i can figure out the real problem. so i run

pod deintergate

and then install my pod again:

pod install

this work prefectly, but the problem is still in there, but i figure out the real problem is the Pods_xxx.framworks not be compiled succeed by cocoapods build script. I think this is the true way to fix the problem.

Finally, i try to edit my project's scheme:

Pods scheme is not in edited

and i add Pods scheme into manage:

enter image description here

and build this Pods.framework separately, and you will find the Pods.framework icon become truly again:

enter image description here

and i think now you have fix your "framework not found Pods_xxxx.framework" problem but actually i have another problem coming:

enter image description here

so i go to the build setting, and edit the "Framework Search Path" with "${inherited}", and now all the problems goes out, cheer!!!!:)

enter image description here

3
  • Adding Pod target and building it actually showed what was wrong with the pod build. In our case this was swift version conflict. Thanks! Commented Apr 26, 2019 at 16:16
  • I didn't follow all the steps. I just added that ${inherited} path, then did Product->Clean Build Folder, and that's it, now it builds without a hitch.
    – Starwave
    Commented Dec 30, 2019 at 15:08
  • I used step -> go to the build setting, and edit the "Framework Search Path" with "${inherited}", and now all the problems goes away,
    – Ram G.
    Commented Jun 30, 2021 at 19:31
5

I have resolved this issue.

delete these three files.

  1. Podfile.lock
  2. Pods folder
  3. .xcworkspace

Then open your project in terminal and run pod deintegrate command, and after then run pod install command

4

After removing and updating pod I still had same issue.

I've found that previous developer put flag in 'Build Settings -> Other Linker Flags' with Framework name (in my case -framework 'OGVKit') that made the issue.

After deleting that flag, project builds properly.

1
  • Thank you so much! You always have to keep an eye on stuff that are bold in Build Settings! Commented Nov 20, 2019 at 19:03
3

Other thing that solved my problem is to go under Target -> Build Settings -> Other linker Flags and delete the "-framework" and your framework "name".

It happened when i tried to remove a pod.

3

in my case, my problem was the following: ld: framework not found UserMessagingPlatform.xcframework

for me, the solution was the following:

  1. open a finder window and go to the ios folder
  2. look for the following files:

Pods-[YOUR PROJECT NAME].release.xcconfig

Pods-[YOUR PROJECT NAME].debug.xcconfig

enter image description here

  1. open those files and remove the following text: -framework "UserMessagingPlatform.xcframework" in both files
1
  • it doesn't crash if i do it, but.. everytime I do pod install then that line is added again and crashes. Also, what happens if I need this framework in the future? I think that is not the solution Commented Dec 4, 2020 at 11:54
2

I did experience this problem because I did not set the platform correctly.

So in my macOS app I had the platform set to:

platform :ios

instead of

platform :osx
2

In my case, there was a reference to the library I removed on

Targets > Build Settings > Runpath Search Paths

Removing the library from Podfile and updating it obviously didn't remove it, so I had to do it manually and now everything works.

2

None of the previous answers pointed out the root problem in my situation. So I hope this may be useful to someone else.

In my case I ended up having to edit my podfile at the root of my project. When I first created my podfile, swift static libraries were not supported. So I had been using use_frameworks! in my podfile under each of my targets as such:

BEFORE

...
target 'targetName' do
   use_frameworks!
   pod 'podName', '~> 0.2'
end

AFTER

...
target 'targetName' do
   pod 'podName', '~> 0.2'
end

I removed use_frameworks! from my podfile which kept installing the frameworks every time I ran pod install. After removing this line, make sure to run pod install again and remove any of the red .framework references from your Frameworks folder in Xcode. (Though mine appeared differently as attached below.)

Image of Removing .framework files that are no longer necessary

You can also read more about use_framework! here.

2

I had the same issue after removing some pods from my project. First I have used pod deintegrate after that pod install in the terminal but didn't work for me. So I went to the second step inside my project Build Setting and on the Other Linker Flags option, I have found that the deleted frameworks are not removed so I removed them manually.

1
  • 1
    This worked for me. I had to remove two lines, 1. framework name; 2: "-framework"
    – user832
    Commented Jun 7, 2022 at 2:42
1

I resolved this issue by selecting the project which downloaded from CocoaPods and built it, you can click Manage Schemes so that it can be appeared in Run bar. Then you can rebuild your project. Hope it help.

1

I tried every answer on here and none of them worked. I ended up getting it working by upping the deployment target from 10.0 to 11.0. I have no idea why that fixed it, but I suspect it has to do with upgrading to Xcode 10.2.1.

1

maybe you suddenly open the wrong file of .xcodprj and you should open .xcworkspace

1
  • It is better to post such this as a comment. Commented Jun 16, 2019 at 3:57

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