How to completely remove cocoa pods from project? - ios

I have a project that had 3 cocoa pods installed. I decided I only need one of them, so I removed the other 2. I removed the two associated lines from my pod file and then ran pod install from the command line. It ran OK and said that removing the two cocoa pods was successful.
Yet when I go into my project, I am still able to import the libraries from those pods. I am still able to run functions specific to those pods. I have scoured my project and all of its files and I can't find any files related to those 2 pods, so how is it that function calls to those pods are still working? How do I actually get rid of these cocoa pods?

You can open the "podfile" and remove those pod lines and from terminal go and do the pod install and it will remove pods you just removed from the "podfile". For example remove line pod "TextFieldEffects".
Here you remove the higlighted line.
It will keep only the ones you kept in the "podfile" and removes everything else.

I was able to fix this by clearing the derived data and then doing a hard clean.
To clear derived data:
Select your Xcode project and go to Preferences.
In the Preferences Menu, select Location. Click on Arrow at trailing end of derived data.
The folder opens. Select all projects in DerivedData and move to trash.
To perform a hard clean:
Press Shift-Alt-Cmd-K
Once I did these steps, function calls to the removed cocoa pod libraries ceased to work.

Check Pods folder that exists in your project folder. If there exists this deleted libraries, than delete them, if not - than they are deleted from pods.

Related

ld: framework not found Alamofire 5.0 [duplicate]

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,
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
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.
Xcode 9, 10, 11, 11.5
install https://github.com/CocoaPods/cocoapods-deintegrate
pod deintegrate
then
pod install
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?
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
Hope this helps. Cheers.
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.
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.
you should delete your project some file as this picture.
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
Just Remove your .framework from the list of "Your Project->General->Linked Framework & Libraries".
It's happened to me because I changed the Deployment Target in General but forgot to change the Deployment Target in Pods > General.
[Xcode 11.2.1]
For me it was different app target version in Podfile(platform :ios, '11.0') and in Xcode project file .
It causing Archiving job fail in CI pipeline.
Matching both value fixed an issue! Hope this help anyone.
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…
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.
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.
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.
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.
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
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:
and i add Pods scheme into manage:
and build this Pods.framework separately, and you will find the Pods.framework icon become truly again:
and i think now you have fix your "framework not found Pods_xxxx.framework" problem
but actually i have another problem coming:
so i go to the build setting, and edit the "Framework Search Path" with "${inherited}",
and now all the problems goes out, cheer!!!!:)
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.
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.
in my case, my problem was the following: ld: framework not found UserMessagingPlatform.xcframework
for me, the solution was the following:
open a finder window and go to the ios folder
look for the following files:
Pods-[YOUR PROJECT NAME].release.xcconfig
Pods-[YOUR PROJECT NAME].debug.xcconfig
open those files and remove the following text: -framework "UserMessagingPlatform.xcframework" in both files
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
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.
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.
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.
I have resolved this issue.
delete these three files.
Podfile.lock
Pods folder
.xcworkspace
Then open your project in terminal and run pod deintegrate command, and after then run pod install command
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.
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.
maybe you suddenly open the wrong file of .xcodprj and you should open .xcworkspace

After installed framework from pods, not able to import in class in Swift project

I have installed some framework by pod file in my Xcode project. I am using Xcode 9.2. Its installed successfully, but, while trying to import that third party framework to my main class, showing no such module found.
Even tried so many times complete clean and rebuild. But, still showing the error No such module found OR Cannot load underlying module for XLPagerTabStrip.
In framework search paths it's showing like below PFA.
If you face No such module found XLPagerTabStrip, then:
1) Click on your app name on side of a select simulator for a run and click on the manage scheme.
2) Try to find XLPagerTabStrip And checked it and close it.
3) Then click on the app name where you can see XLPagerTabStrip.
4) Then click on it then clean build project and again choose your app and then again clean and build.
where you have to click in the screenshot. you can find Demo
Couple of things you can follow :
Clean project + Remove derive data and build again.
Check the Pods project on Xcode and make sure your pod exists in the Pod folder under Pod project.
Add the Pod in Embedded Framework in project settings.
Edit your scheme :
Scheme menu > Manage Schemes > check Pods > Close
Select Pods from the scheme menu.
Build Pods.
Select your project from the same menu, then build/run it.
Reinstall Pod :
pod deintegrate
pod install
Make sure you are correctly setting the pod in Pod file. Refer to original Github page of the library for the correct format.
First clean your code
right after pod installation is complete, build it once. Don't import pod files till now.
After build is succeeded now you will be able to import pod files.
You can try going to
General -> Linked FrameWorks and Libraries
Click on plus button and search your installed pod(installed as framework, if UserFrameWork! is mentioned in podFile) and press Add.

CocoaPod : Unable to remove the Pod from project

I have a xcode (iOS) project in which i am cocoapods.
I have couple of pods installed:
SwiftHTTP & SwiftyJSON.
Now for some reason I decided to try another pod namely EZAlertController. Nothing wrong with the pod. But i decided not to use it. So I need to uninstall this pod from my project.
So far whatI have done:
remove pod 'EZAlertController', '0.3'from the podfile
run pod install which gave me the message of
Removing EZAlertController
No EZAlertController folder in the Pods folder either. So far so good.
Now i closed the xcode and reran the .xcworkspace file.
clean & build routine - all good - Again
P.S.(also tried pod update)
The Problem:
I am still able to import EZAlertController into the project and run. What is really annoying is that I forgot to take a git snapshot. So can't just revert back without loosing considerable amount of code.
Any idea on how to completely get rid of EZAlertController even after removing as there is still some linking with xcode :(
Try to clean the project: Product -> Clean and also Product -> (hold option key) Clean Build Folder
Maybe deleting the derived data could resolve your issue
I wouldn't remove the pod. I've had this problem before. I tried blowing away all the pods but continued to experience the problem. What I would do is blow away all the pods, reinstall Cocoapods to the project, then try installing it again.
Alternatively you can add the framework you need manually.

When using cocoapods, what is the best way to change the PRODUCT_NAME?

I created an app with name "ABC". Months later I decided to change the name to "ABCD". I believe the way I changed it, was in my Podfile, I changed target "ABC" do to target "ABCD" do. However, I recall going through quite a few issues/errors afterward in my workspace that caused a lot of stress. It was so long ago that I can't quite recall though.
Now I'm ready to submit, and I want to change the name one last time. I've changed the name in iTunes Connect, but now I want to change my PRODUCT_NAME, and my bundle identifier to match.
What is the best way to do this? Should I change the target fields in my Podfile? Or should I leave them, and just change something else in Xcode? Or do I need to change both or more than one thing?
When you have a Pod file the .xcworkspace and Pods.xcodeproj is generated dynamically by the pod install process.
So one way to deal with this is
Change your product name
Close the project in Xcode
Discard the existing .xcworkspace, Pods folder & Podfile.lock
Run pod install again.
The cocoapods engine will regenerate its project, pull the Pods from its cache and recreate its Pods.xcodeproj with the new project settings.
This might be a little more complex in the case where you have other dependancies besides your main project and the Pods project in your workspace.
You'll probably want to have everything committed to source control before you do this so you can revert if it goes wrong.
I solved if for my project with this steps.
I install cocoapods-deintegrate
[sudo] gem install cocoapods-deintegrate
and call pod deintegrate on my project.
open XCode, click on project name and click again with delay to rename, follow xcode instructions
run pod install again on your project.
NOTE: if you are just Capitalising, or Uppercassing project name do it with other temp name: for me locdel->aaa->Locdel.
I've been scouting the internet to no avail looking for an answer to this. While editing the podfile and running pod install again fixes the renaming problem, in my case it broke my application as those pods had evolved while my app had stayed the same.
If you have concerns about backwards compatibility and don't want to reinstall your dependencies I suggest you do as I did and edit directly the .xcworkspace and .xcodeproj files using a text editor.

Xcode cannot see the file added manually into cocoapod

I maintain my 3rd party libs with cocoapods. But recently I found some bugs and would like to add some new features to one of the libs so I manually created some .h and .m files in one of the libs.
However when importing those added .h files, Xcode gave the file not found error and couldn't compile them.
How can I solve the problem?
Thanks.
When integrating the Pods into your project, CocoaPods generates libraries that cannot be easily modified from Xcode. If you're having CocoaPods build frameworks, instead, those cannot be modified at all. You usually have to rerun pod install or pod update to let CocoaPods regenerate them if you add files to a Pod.
If you want to reliably add files to a Pod, you should checkout a copy on your machine, somewhere NOT in you project's folder and use something like the following to tell CocoaPods that that one Pod is one you're developing and therefore should integrate differently:
pod MyPod, :path => 'path/to/MyPod.podspec'
Still, even in this case, if you add files to the Pod, although it's easier to add them from Xcode, you might want to rerun the pod command line tool to have CocoaPods reintegrate your pod. However, in this case, you'll only have to make sure your files are added to the right project target in order to add files directly from Xcode.

Resources