I have a new project where I am using XCode 7 beta 3 and Swift 2.0 using GoogleMaps imported via cocoapods. This is a WatchKit 2.0 app, so I have a main target for the iPhone (Destinations), a target for the Apple Watch (Destinations WatchKitApp & Destinations WatchKitExtension) and an internal framework (DestinationsKit) that does the heavy lifting for interacting with GoogleMaps among other things.
I can successfully import GoogleMaps into the main target (Destinations) and have been successful in displaying a map.
import UIKit
import DestinationsKit
import GoogleMaps
class DestinationDetailsViewController : UIViewController
{
// our selected destination
var destination: Destination!
// our map view
var mapView : GMSMapView!
// ... code to display a map centering on the destination ...
}
The code above imports my internal framework, DestinationsKit, and successfully uses GoogleMaps.
However, I am now writing the code that calculates a route between two points and am adding that code to the internal framework (DestinationsKit). Whenever I try to import GoogleMaps, I get a 'No such module 'GoogleMaps''.
import Foundation
import CoreLocation
import GoogleMaps // Error 'No such module 'GoogleMaps''
public class UserTrip {
}
I have done the following with no success:
- 'In Build Phases' -> 'Link Binary With Libraries', I have added the Pods.Framework (which is what I did with success in the main target)
- Set 'Allow Non-modular includes in Framework Modules' to Yes
- Set 'Packaging'->'Defines Module' to Yes in Build Settings
My Pods file is as follows:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod 'GoogleMaps'
I ensured the Pods.Framework is included in both targets. So, I cannot figure out why the main target can find GoogleMaps, but my internal framework cannot.
Thanks in advance!
Of course, as soon as I post the question, I figure out the reason.
Even though I manually added the Pods.framework to the Build Phase, I needed to update my Pods file to include the framework as a target and then run 'pod install' again. So, the updated Pods file is:
Not sure if the 'target' lines are necessary, but are good to include so target-specific dependencies have a home.