I can't use Cocoapods to update Podfile - cocoapods

I wanted to open app(UAAppReviewManagerExample),but this demo uses CocoaPods, so I wanted to update Podfile, but it failed. It asks me to find my another app's xcodeproj file in my Mac. What should I do?

You are opening wrong file, You have to open xcodeworkspace and not xcodeproj.
Also check whether instead of deleting files from project, have you deleted the files of dependency from pods. Because according to image you sent, Xcode is unable to find the files on your system, but it is getting an update request from podfile.

Related

Pod files are missing

I am new in iOS dev, but I need to build a certain project. The problem is that when I click on the build button xcode fails and one of the errors says
Unable to load content of list : path_to_pod_file
as well I see that in project structure xcode marked missing files with red color
I read about pod files and understood that it is a kind of configuration file, so the question is: are these files should be generated by build (somehow) or it is files that I hadn't received with a project and there is no way to generate them?
I found a solution here:
https://medium.com/#soufianerafik/how-to-add-pods-to-an-xcode-project-2994aa2abbf1#
Actually, the files I asked for above are generated and I needed to install the pod and run the Pod file which (in my case) was under my project structure.
sudo gem install cocoapods
cd PATH_TO_YOUR_PROJECT_FOLDER
pod init (IN CASE IF YOU HAVEN'T ALREADY HAVE IT)
pod install
Double click on the Xcode workspace to open the project
You can clean/re-build your project and run it.

Podfile.lock: No such file or directory

I have scavenged all over the internet trying different solutions to solve this issue however none of the pod install or cocoapods update worked then clean and build worked. This xcode project was created from an exported Unity3d project and the podfile, podfile.lock, and pods folder was already created when I exported the project.
Here's the error screen. There is also a warning which says the debug.xcconfig couldn't be opened because there is no such file however it does exist and the path to it is correct and the configuration tab in the build settings doesn't let me select anything but none:
Here's the podfile I have:

Multiple targets for project in xcode

I am using xcode 7.3.1. After pod update, it's showing multiple project target in the project having same details without any change. How can I fix this? If I delete any one of these, xcode crashes and when we reopen even the other option comes in red and we dont have any project.
Have you tried to delete the workspace file and the pod directory, and re-launch a pod install ? The workspace file does not hold any important information to be retained in CocoaPods.
If you have the same problem after regenerating, it means there is an error in the Pod file.

Can I delete the xcodeproj after pod install?

I know that I have to use the .xcworksapce file after I did pod install.
But today, I accidentally opened the .xcodeproj file and the whole project broke! And the problem described in this question occurred.
So I want to delete the .xcodeproj file so that I will never break my project by opening it by accident. Can I do that? I didn't try it because I'm afraid I will break my project again.
No, you can't. In fact the xcworkspace file use xcodeproj file of you project.
The purpose of the xcworkspace file is to make the merge between your project (and its xcodeproj) and the Cocoapods projects (and its Pods.xcodeproj).
EDIT:
If you want to move your xcodeproj to a subfolder (to avoid mistakes), you just have to update your podfile and add:
xcodeproj 'subfolder/yourproject.xcodeproj'
Then, delete your xcworkspace, and do a pod install.
Be careful: this works only if your Workspace contains just your project and the pods.

Cocoa Pods without workspace?

I have read about a possibility to add CocoaPods to an XcodeProject without getting the xcworkspace file, instead you get a xcodeproj file that you can integrate into your current project. How can I do that? Would love to use the xcodeproj file instead of xcworkspace.. I'm programming in swift (if that makes any difference).
Yes, its possible. But, we need to do few steps to proceed.
Check this Github thread.
The below line in pod.file will not let the client integration process.
install! 'cocoapods', :integrate_targets => false
We can drag and drop the Pods.xcodeproj to the main project
Link the target dependencies and Link Binary with Libraries in Build phases.
Thats it.
You can not do this.
The CocoaPods website guide to using CocoaPods found here directs you to using the .xcworkspace it creates. Several other guides found across the Internet all direct you to use this file indicating that using the .xcodeproj file will now result in build errors.
There is simply no evidence that this is a possibility at all.
From the CocoaPods website guide on using CocoaPods:
Save your Podfile.
Run $ pod install
Open the MyApp.xcworkspace that was created. This should be the file you use everyday to create your app.
More from their website:
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
And from the Ray Wenderlich guide regarding using CocoaPods with Swift:
Open the project folder using Finder, and you’ll see that CocoaPods
created a new IceCreamShop.xcworkspace file and a Pods folder in which
to store all the project’s dependencies.
And from an NSHipster article on CocoaPods:
CocoaPods will create a new Xcode project that creates static library
targets for each dependency, and then links them all together into a
libPods.a target. This static library becomes a dependency for your
original application target. An xcworkspace file is created, and
should be used from that point onward. This allows the original
xcodeproj file to remain unchanged.
In older versions of cocoapods it was possible to install and update pods with the option '--no-integrate'. It allows you to create a library project, which could be imported into an existing project (read more). But this option is missing now. I've build a Xcode project for a maven-build with this option earlier. Today I've updated the pods of this project with the newest cocoapods version (1.0.0) but without the '--no-integrate' option and it still works. So eventually there is a way...

Resources