Pods not found when downloading project zip from GitHub [iOS] - ios

I downloaded a zip of my own project from github but keep running into an error on building it. 2 out of 5 libraries I installed using cocoapods, though present in the pods folder, aren't identified by Xcode, specifically, SDWebImage and YTPlayerView.
Can anyone tell me how to fix this?

As intboolstring said, ensure you run pod install inside the directory of the project you have downloaded, however what I have found is that you should also build the project after running pod install, as it sometimes does not link the pods to the project. Do this using the .xcworkspace file.

When downloading a git project, the project comes with the Podspec file, which specifies which dependencies need to be downloaded. To download the required dependencies for your project, you can run
pod install
Also, to make sure that the dependencies are loaded, open the .xcworkspace file. If you can't find the workspace, you can go to your project directory and run
open `ls | grep xcworkspace`

I fixed the problem with the pods. Adding import pod name to the affected classes fixed it.
For some reason, the local copy of the app works fine, even without said import statements.

Related

question about module import error of cocoapods

I am new to Swift and Xcode, I once import Alamofire, SwiftyJSON using cocoa pods in some tutorials, In the beginning, everything works fine, but recently every time I restart my swift project, I always get an error of No such module 'Alamofire', and the pods_proejctname.framework in Frameworks is lost but I didn't do anything:
However, the files in Pods in Xcode repositories doesn't show complete files and folder as finder shows:
If I opened the pods XCode project, the files in the products folder is missing, but I didn't do anything:
When I tried to fix it, this error somehow disappears. Can someone help me with this problem? please comment on my post if you need me to show further information about my project. Thank you!
you have lost path to your libraries in your project. Instead of configuring your path manually just remove your project from cocoa-pods and configure it again. Run the following commands on your project from the terminal
step 1
pod deintegrate
step 2:
delete Podfile.lock and yourproject.xcworkspace file manually from your project. also if delete the pods folder from your project if exist.
Step 3:
install pods again by running
pod install

Missing required modules after installing new cocoapod

I have a project that's using several custom frameworks. These custom frameworks have some pods as dependencies like Alamofire, SwiftKeychainWrapper, etc., so I have these installed in my main project.
Everything works just fine until I try to install a new pod ('RealmSwift') that a new custom framework has a dependency on. After I install it I get this error:
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I'm able to resolve this by adding two USER_DEFINED build settings for PODS_PODFILE_DIR_PATH and PODS_ROOT (but why did running pod install change this?)
Then when I try to build, all my custom frameworks that have pods as dependencies give this error when trying to import:
Example:
Missing required modules: 'Alamofire', 'SwitfKeychainWrapper', etc.
Why can't Xcode see these modules? They're exactly where they were before.
I've tried everything to resolve this. Cleaning, deleting derived data, deintegrating my pods and reinstalling all of them, editing the import paths and header search paths, nothing seems to work.
I'd be so grateful for any help!
It seems to your pod require to update.
Please execute this command.
'pod update'
Add Alamofire and SwitfKeychainWrapper into your embedded libraries. Usually this solves the problem but still if it doesn't, then try to add both of them in Linked Framework and Libraries as well as embedded libraries.
I finally figured this out. When I ran pod install, it was completely changing my build settings. Particularly, it was changing the path of where to find the Pods.xcconfig files.
If you go to Project (above Targets) -> Info -> Configurations you should see Debug and Release xcconfig files for Pods. If Xcode can't find these files, it won't be able to use any pods.
So my solution was to just discard all changes to my project file (where build settings are managed) after running pod install.

Cocoapods error for one project target while others are working fine

I have create 3 project target (Development, Production and Staging).Expect Production other working fine after pull the changes of others while building the production target xcode giving the error :
gone through some of the available solution but no success!!!
If you change something the conflict will be occur, do like remove your WorkSpace once and again install or update your Pods,it will Work
Run pod install or pod update your CocoaPods installation.
For additional Information see this1
Choice-2
there's a problem with Cocoapods in your project. Sometimes cocoapods can get out of sync and you need to re-initiate cocoapods. You should be able to resolve this error by:
Deleting the Podfile.lock file in your project folder
Deleting the Pods folder in your project folder
Execute pod install in your project folder
Do a Clean in Xcode
Rebuild your project
Conclusion: don't run pod install while project opened in the Xcode.
Update answer
I. Project Cleanup
In the project navigator, select your project
Select your target
Remove all libPods*.a in Linked Frameworks and Libraries
II. Update CocoaPods
Launch Terminal and go to your project directory.
Update CocoaPods using the command pod install
I have solved my problem by this way :
After implementing lot many solution i got this error :
By removing Check pods manifest.lock, Copy pods resources and Embed pods frameworks from Build Phases of Tests project target(xxxTests) i solved the issue.
NOTE: If any one still getting any issue related to pods, then try to remove libpods-xxx.a from Link Binary with libraries and again add it.

iOS: Cocoa Pods: Code Compile Issue

The Problem
I recently started working on a project.
Which Uses Cocoa Pods as the dependency manager.
It also uses Crashlytics for crash reporting.
Image Magick for Icon generation and Synx for reorganizing the project folder.
I was given Git access.
So I cloned the repo.
did a pod install
and compiled the code but it started giving me following error.
Project target is iOS 7.
Cocoa Pods Version is 0.36.4 also tried Latest 0.38.2
It is an iphone only app.
What I have done So far trying to solve this issue
So I sat down with the Original developer who was very helpful and had a working copy of the code on his machine. As it was a code handover so he was helping me setting it up on my machine.
We have tried all the usual suspects.
Clean and Build
Clean Quit Xcode Reopen and build
Quit xcode delete the Pods Directory and do a pod install
pod setup
pod update
Checked PODS_ROOT paths for different build configurations with working copy on another machine where it compiles correctly
My pods were latest so I uninstalled cocoapods using sudo gem uninstall cocoapods and installed the version the original developer had sudo gem install cocoapods -v 0.36.4
Matching Xcode versions xcode 6.4
Checking Configurations under Info in Project
Another pull from Github at a different location and doing all above steps.
Clear Xcode derived data folder.
So basically we checked all this retried all the above steps many times and also verified project settings build phases etc.
code is running fine on his machine.
Some weird behaviour i noticed was that one time instead of above mentioned error in picture it gave the famouse xyz.h file not found error for one of the libraries in Pods. But doing a pod install reverted back to original error.
Any ideas?
I remember this one.. I think it is due to cocopods changed the directory of there "copy pods resources" shell script from one version to the other. Look under your targets build phases and check for a "run script" entry i think. Look at the path and then check in finder to see where the shell script is really located.
Not really certain of the details... it might have been one of the other cocopods enters in the build phase section. Look around there, I do remember it was pretty easy to spot when you know where to look.
Should probably be the "Check Pods Manifest.lock" section under Build Phases.
Make sure you are opening workspace project(.xcworkspace) instead of XCode Project..
Else
Remove podfile.lock
Remove Pods Folder
Remove .xcworkspace
Remove manifest.lock (if exists)
Go to path of pod file and Run pod install
Then it will generate .xcworkspace.
Now onwards you need to use workspace instead of xcodeproj
Hope it helps you..!

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