Search code examples
iosparse-platformcocoapodstvos

Can I use the same podfile (cocoapods) for a project that has both iOS and tvOS Targets?


I am trying to create a tvOS version of an existing iOS app that I have, and want to be able to reuse a lot of the same code (i.e. 3rd party libraries, data managers, etc) so I am using the same .xcworkspace with just an iOS target and a tvOS target.

Since I use cocoapods for all 3rd party libraries, and will need to reuse some (not all) of them for the tvOS app (i.e. Parse), I want to know the proper way to integrate cocoapods with my project.

I am getting this error when trying to compile for tvOS target, but not the iOS target:

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

And yes, I have tried all the usual cleaning the project, deleting the .xcworkspace, rerunning pod install, etc.

My podfile looks like this:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
use_frameworks!

pod 'Parse'
pod 'ParseFacebookUtilsV4'
pod 'Fabric'
pod 'Crashlytics'

Solution

  • I believe you can use link_with to specify multiple targets for your podfile to link against.

    Example:

    link_with 'MyAppTarget', 'MyTvTarget'