Trick to add a proprietary binary framework to project with Cocoapods
Cocoapods does not offer a simple way to link a framework from a local path, only by using a :http with link to zip archive. Well, I found a workaround for this. Imagine, you have some proprietary binary framework without source code and you want to add it as a pod rather than link it to the project manually. In that case you can create a private pod with a podspec like this:
Pod::Spec.new do |s| s.name = "SuperCoolLibrary" s.version = "0.0.1" s.authors = "" s.summary = "SuperCoolLibrary for iOS" s.license = { type: 'Commercial', text: '© Company' } s.prepare_command = $TMP_PATH/SuperCoolLibrary.zip echo start http ruby -run -ehttpd "$TMP_PATH" -p9000 & PID=$! echo will terminate webserver later (sleep 20 && echo killing webserver && kill $PID) & CMD s.source = { :http => 'http://localhost:9000/SuperCoolLibrary.zip' } s.source_files = "./SuperCoolLibrary.framework/Headers/*.h" s.public_header_files = "./SuperCoolLibrary.framework/Headers/*.h" s.vendored_frameworks = "SuperCoolLibrary.framework" s.platform = :ios, '8.0' s.requires_arc = true end
In prepare_command we create a zip archiveof a binary framework in a temporary directory, start a local webserver and killing it 20 seconds after (enough for cocoapods to "download" a zip).
And that's it. Add "SuperCoolLibrary" to your Podfile and happy coding!














