I am using Xcode 7.1, and the deployment target is iOS 9.1. The application is an "AreaCalculator" and it was written in Swift. I did the following to set up the structure and import the map:
$ sudo gem install cocoapods
under "AreaCalculator" $ touch Subfile
in subpixel:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
pod 'GoogleMaps'
$ pod install
in terminal:
[!] Unable to load the specification for the plugin /Library/Ruby/Gems/2.0.0/gems/cocoapods-try-release-fix-0.1.2
Updating the local specifications stores Dependency analysis Downloading dependencies Installing GoogleMaps (1.10.5) Generating Pods project Integration of the client project
[!] Close all current Xcode sessions and use AreaCalculator.xcworkspacefor this project from now on. Sending statistics Stand completely! There is 1 subfile dependency and 1 total pod.
After that, I selected the AreaCalculator folder in the Navigator and select File \ New \ File ..., then select the iOS \ Source \ Objective-C File Template and create a bridge file:
"AreaCalculator-Bridging-header.h".
- "# import GoogleMaps / GoogleMaps.h
Then I add “GoogleMaps.framework” to “Link Binary With Libraries”. Both "GoogleMaps.framwork" and "GoogleMaps.bundle" are in Pods.
After everything is done, in AppDelegate.swift, I will put:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let googleMapsApiKey = "MY_GOOGLE_IOS_API_KEY"
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
GMSServices.provideAPIKey(googleMapsApiKey)
return true
}
}
However, the compiler showed me the error "Use of unresolved identifiers" GMSServices ".
, ? ?
!