You need 3 things:
(1) Well formed Podfile
platform :ios, '8.0'
target 'GoogleDrive' do
pod 'Google-API-Client/Drive', '~> 1.0'
end
(2) Expose Google API through the bridging headers
#import "GTMOAuth2ViewControllerTouch.h"
#import "GTLDrive.h"
(3) No reference GTLDrive required in the Swift client class
override func viewDidLoad() {
super.viewDidLoad()
// ...
let service:GTLServiceDrive = GTLServiceDrive()
service.authorizer = GTMOAuth2ViewControllerTouch.authForGoogleFromKeychainForName("Drive API",
clientID: "YOUR_CLIENT_ID_HERE",
clientSecret: "YOUR_CLIENT_SECRET_HERE")
// ...
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…