The Setup
I have successfully integrated the GoogleMaps SDK into my Swift 2 project using CocoaPods.
My setup is pretty much that suggested by the Ray Wenderlich tutorial on the subject. The only difference I can find is, I have to add this line to AppDelegate:
import UIKit
import GoogleMaps // <- THIS LINE
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
...
...in order to use the framework's classes. The tutorial suggests importing:
#import <GoogleMaps/GoogleMaps.h>
...to the bridging header instead.
The app works without problems.
The Problem:
When I tried to run the test target auto-generated by Xcode, I get the error:
No such module 'GoogleMaps'
...pointing at the to the swift import statement in AppDelegate above.
So, I decide to switch to the way it is in the tutorial instead: I comment out the line import GoogleMaps
in AppDelegate.swift and add an Objective-C-style import statement to the bridging header.
However, I can not get it right:
If I use:
#import <GoogleMaps/GoogleMaps.h>
or#import "GoogleMaps/GoogleMaps.h"
, it gives me:Use of unresolved identifier 'GMServices'
at AppDelegate.swift when building the app target.
If I use:
#import "GoogleMaps.h"
, it gives me:'GoogleMaps.h': file not found
at the bridging header.
I have tried the solution in this answer, but the results are (puzzlingly) the same...?
Next, I checked the value of Build Settings / Search Paths / Framework Search Paths
for both targets (app and tests). The app target had the entry:
"${PODS_ROOT}/GoogleMaps/Frameworks"
...which the test target lacked, so I added it, and reverted to the swift-style import (the only one that works at least when building the app target), but I still get:
import GoogleMaps <! No such module 'GoogleMaps'
How can I run tests for my app??