Last Updated: February 25, 2016
·
1.186K
· adamyanalunas

Running PSPDFKit's latest build with a local podspec

Cocoapods is great for managing huge dependencies. What's not great is when there aren't podspecs for things like nightly builds of those dependencies. Sure, you could remove the entry in your Podfile, drag in the dependency and configure it manually but isn't that why Cocoapods exists?

I needed to test the nightly build of PSPDFKit and while there's a dmg available to download and integrate there's no convenient podspec. Drat.

The solution is to make your own podspect and point it to the nightly build.

First, copy the PSPDFKit podspec (3.6.1 as of writing) and save it to the root of your project as something like pspdfkit_nightly.podspec.

Now find the source line in your new podspec and change it to something like s.source = { :http => "http://localhost:8000/PSPDFKit.latest.zip" }.

Next, download the public nightly, mount the dmg, extract the PSPDFKit.embeddedframework and compress it. Rename the zip to PSPDFKit.latest.zip.

Finally, open Terminal.app and browse to the same directory as that zip you just created. Type in python -m SimpleHTTPServer and now you're locally hosting that file.

Now all that's left is to go back to your project directory and run pod. It should pull in that nightly version you put in a zip.

Caveats:

I ran into a number of issues that I think are related only to my setup. When in doubt nuke your ./Pods/ directory and make sure your ~/Library/Caches/Cocoapods is empty (rm -rf etc) and chown'd to you (chown -R $USER ~/Library…etc.)