Building an iOS Cocoapod that uses the Dropbox Sync API

One of the frameworks we're building at Punch Through Design links to Dropbox to help users access their files from both iOS and their computer. Dropbox provides a very useful Sync SDK for iOS that makes it easy to access Dropbox accounts.

Installing the Dropbox SDK can be complicated, so I simply used Cocoapods to install the Dropbox iOS Sync SDK for use with our framework.

I wanted the framework to be easy to install into any project, so I made efforts to distribute it as a Cocoapod. This caused problems: I needed to write a Podspec that included the Dropbox SDK as a framework dependency, and the Podspec documentation is sorely lacking. I couldn't figure out how to write a podspec that included the Dropbox SDK as a pod dependency AND linked the Dropbox framework so Xcode could find all its headers.

We ended up stealing some lines of code from the ParcelKit podspec—they also list the iOS Dropbox SDK as a Cocoapod dependency, and they seem to have it figured out.

Here are the important lines of code from our Podspec file:

Pod::Spec.new do |s|
  # ...your code goes here
  s.frameworks   = 'Dropbox'
  s.dependency 'Dropbox-Sync-API-SDK', '~> 3.0.2'
  s.xcconfig     = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}/Dropbox-Sync-API-SDK/dropbox-ios-sync-sdk-3.0.2"' }
end

I believe you'll need to change the framework search path if the Dropbox SDK version changes. This code helped me successfully link our Podfile with Dropbox, minimizing the amount of damage we had to do to our .xcodeproj file.