WatchOS 2.0 Alamofire pod install

I was dealing with this simple issue for couple of hours and decided to write a short instruction on how to integrate pod libraries into multi target project that includes WatchOS 2.0.

I wanted to add Almofire and SwiftyJSON to my newly added watchOS 2.0 target but soon realised it wasn’t as simple task as I thought it would be, However there is a quick fix for that and you need to simply edit your pod file and include following to include libraries that you’d like to integrate to your WatchOS Target.

target ‘TargetName Extension’ do
platform :watchos, ‘2.0’
pod ‘Alamofire’
pod ‘SwiftyJSON’
end

ultimately you can nest iOS platform under the iOS target to make things more organised. Your podfile for a multi target project for iOS and WatchOS will look similar to this

use_frameworks!
target ‘iOSTagertName’ do
platform :ios, ‘8.0’
pod ‘Alamofire’
pod ‘SwiftyJSON’
end

target ‘watchTargetName Extension’ do
platform :watchos, ‘2.0’
pod ‘Alamofire’
pod ‘SwiftyJSON’
end

However after doing this I got this wired error :

[!] [Xcodeproj] Generated duplicate UUIDs:

and there seems to be an issue with Cocoapod and they are looking into it, but a quick fix would be to paste this line into your terminal :

export COCOAPODS_DISABLE_DETERMINISTIC_UUIDS=YES

After that everything installs nice and smooth and you shouldn’t get any errors

Hope this saves someone a few moments of troubleshooting. :]

Show your support

Clapping shows how much you appreciated Mo Lotfi’s story.