Check if an iOS project is using Cocoapods - ios

Is there a way to figure out if an iOS repository is using cocoapods or not?
At my first thought I was planning to use github api and check if the Podfile exists. But there could be repositories which has podfile but are not actually using it.
I am working on a ruby script in which I need to figure out if the iOS repo's is using cocoapods.

I'd say your best bet would be to do what you're saying and check if there is a Podfile. I think the bigger problem with this approach would be you'd have to check in nested directories too. If you wanted to make this way more complicated than it's worth you could use the xcodeproj gem and look around the project's linked files for the Pods.xcconfig.

Related

How to move from CocoaPods to Carthage?

My project has linked with like 30 different libraries. Very few of them support Carthage.
Do I need to make a branch and make them support Carthage one by one?
Is there any better way to do so?
The carthage idea is based on frameworks. So if your dependencies do not support them, carthage is unable to build them for you. Simple as that.
But: You can use carthage also to manage dependencies only by using the param "--no-build". Then carthage will only fetch the dependencies into your Carthage/Checkouts folder.
There are some drawbacks:
depending on the project you have to add the projects of each dependency to your own project, if the projects only contain a sample app you have to add the code itself
if the projects have dependencies itself carthage is only able to find them if there is a cartfile in the projects, as an alternative you may add the dependent projects to your own cartfile to avoid forking them but then you have to update the versions for yourself
developers see the code itself while work but they should handle them as read-only
...
It's possible to use carthage like that, but I wouldn't recommend it. If you need more informations about this solution read here.
Note: If you fork the projects and make them support carthage the community might be grateful. ;-)
There is no problem in having both Carthage and Cocoapods running on the same project. You can try a hybrid approach and replace the libraries step by step.
You can check this post on it. There, I make my build time 9 times faster by replacing Cocoapods with Carthage, but I discuss how some libraries were hard or impossible to replace.

iOS - update a framework

I built an app that uses a third party SDK. Recently I had to update the SDK with a new version. I removed the framework files from my application folder, copied the new ones, added them to the project, but it seems XCode is caching the old version.
I tried Clean, tried to delete Derived Data, nothing works. At this point it seems the only available option is to recreate the project and import all the source files. Obviously I am not keen on that. There must be an easy, fast solution to this issue.
Any clue?
Cocoa pods are easy to use and install.
CocoaPods is the dependency manager for Objective-C projects. It has
thousands of libraries and can help you scale your projects elegantly.
Ultimately, its goal is to improve discoverability of, and engagement
in, third party open-source libraries, by creating a more centralized
ecosystem.
However the frameworks need to be compatible with cocoa pods which most libraries are. You use terminal to install. This site may give you an idea how to install it.
Fixed it. I deleted all copies of the old SDK, whether or not they were in my project folder. Seems like XCode was linking to one of them... Another mystery.

Integrating CocoaLumberjack into iOS Project via Drag-and-Drop

I'm trying to integrate CocoaLumberjack into my iOS project by dragging-and-dropping the Lumberjack.Xcode file into my project. That works fine, but now my project has 9 new targets. I don't need all of that overhead. So my question is, how do I cut down on the number of targets to just the needed stuff for iOS?
It seems every time I drag over only the mobile project that it is missing needed files. Upon my research, it seems that there are no up-to-date tutorials related to integrating Lumberjack specifically to iOS, which seems like a tool that would be commonly used so that is odd. Being new to all of this, it is troublesome and I would love some help.
Other information: I'm doing a manual installation since Cocoapods is not an option for me. I am following their Installation Guide:
Installation Guide
The very first line in the manual installation guide is
git submodule add git#github.com:CocoaLumberjack/CocoaLumberjack.git
I do not want to add yet another submodule to my project, so I'm dragging and dropping Lumberjack.Xcode into my project.
Before I learned how to use CocoaPods, I used to just clone the repo and copy all of the .h and .m files into my project, ensuring they're added to the correct target.
The only issue you have to make sure to avoid is missing one or more files. Not 100% sure with CocoaLumberjack, but I'd look at just adding everything from here:
https://github.com/CocoaLumberjack/CocoaLumberjack/tree/master/Classes
Instead of adding it as a submodule, you can simply clone the repo and add it to your project. The rest of the instructions remain the same. So replace the line you quoted above with:
git clone git#github.com:CocoaLumberjack/CocoaLumberjack.git
rm -r CocoaLumberjack/.git/
Then follow the rest of the instructions in the install guide.
Instructions from CocoaLumberJack
https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/GettingStarted.md

How to install projects without cocoa pods?

I have seen various libraries on GitHub that look useful, but only list CocoaPods as an install method. I'm not sure I want to be dependent on CocoaPods, because I'm wary of Apple breaking it in some future OS X/Xcode update. Is there a way to get these libraries into my Xcode project without using CocoaPods?
Role of CocoaPods is to automate and simplify the process, but you don't need to use CocoaPods if you don't want to.
In case of "manual installation", usually it would be:
download the project from GitHub
add the files to Xcode
import headers
But there is no universal recipe for every project, it may slightly differ from case to case, but usually it boils down to previously mentioned.
The best way if you don't want to use CocoaPods is to read the project documentation, and study examples if there are any.
Of course there is. Basically you need to download the library project, drag the project into your own project, do some library dependency setup and you're done.
For details, check out https://github.com/Alamofire/Alamofire for manually adding a Swift library. And https://github.com/jverkoey/ObjQREncoder for manually adding a Objective-C library to your project.
The only way to install things without Cocoapods is to just drag the source code of other projects into your class. For example, most Github projects can be installed via Cocoapods, or you can just drag the relevant source code into your projects. You don't need to drag in all of the project resources, all you need is usually class files

How to use cocoapods in an exist ios project

I have an ios project first made in Xcode4.6. I have update it to Xcode5.0.2. Now I want to change the project to using cocoapods to manage the third party pods.
Due to a newer to cocoapods.I search the Internet to how to install cocoapods and so on.Now it's OK.So I run the pod install to get "AFFnetworking 2.1.0". .xcworkspace generate successfully.Then I open the workspace.I saw this in the navigation
There are many question mark.I think this means that Xcode5.0.2 didn't know the AFNetworking 2.1.0 added by cocoapods. And If I write the "#import "AFNetworking.h" in a .m file. Xcode will say that can't find the "AFNetworking.h".
I am a newer to cocoapods. So home someone could help me. Tanks a lot.
Because AFNetworking is linked as a library you need to use the < > import style. So #import <AFNetworking/AFNetworking.h>.
The question marks are coming from your version-control system, not from Xcode itself; they indicate that the files added by CocoaPods are new to version control. I’d recommend committing all of the CocoaPods-related files right away so that you have just one commit that represents “moving to CocoaPods”.
I guess you are using git repository.Add files pod to repository, currently they are untracked thats the reason for '?' there.if the error persists then see the following discussion
AFNetworking Cause Error while using XCTest in Xcode5

Resources