In an effort to keep the lines from being blurred. This post is specifically about using Frank and CocoaPods together. Not how to use Frank or CocoaPods. At the time of this post, there is an open pull request to the Testing With Frank Repo to add a PodSpec to Frank. I personally do not think that it should be done because while it keeps your repo smaller and makes building your project with frank a little easier, it doesn’t really work with other parts.
When using Frank and CocoaPods together, set up the project to use CocoaPods first, and then add Frank. For instructions for setting up your project with CocoaPods click here.
Whether you do CocoaPods or Frank first, you will still have to manually massage things back into place, and I found it easier to do it in this order. When adding Frank to a project that uses CocoaPods, we’ll encounter 2 specific problems
- Both CocoaPods and Frank use a custom .xcconfig to override the OTHER_LDFLAGS linker flag setting (and some other things).
- Because CocoaPods uses an Xcode workspace instead of an Xcode project, we have to build things a little differently.
Because Frank and CocoaPods both need their own .xcconfig files, we need to add a special .xcconfig file for the Frank+CocoaPods build.
Add a .xcconfig file to your project and name it something simple like “Pod_and_Frank.xcconfig”. This file will be really simple:
Depending on your particular folder structure, you could have to change things slightly.
Once you’ve created this xcconfig, you just need to set up your project to use the xcconfig. The image below shows you where in Xcode that setting goes. Just set up your Frank target to use “Pod_and_Frank.xcconfig.” ONLY CHANGE YOUR FRANK TARGET.
You may also need to check your Other Linker Flags for your frank target to make sure they still include $(FRANK_LDFLAGS)
When you build your project things are slightly different than normal. Normally you just run frank build in the proper directory. But because we are using CocoaPods, we have some extra parameters. But don’t worry, because it’s not hard. It just sounded complex when I first looked it up.
cd <folder with your xcworkspace in it>
frank build --workspace <workspace> -scheme <scheme to build>
The scheme to build is just the Xcode scheme (in the top left corner) it’s usually the name of your target unless you created your own schemes.