對REST端點谷歌API的Objective-C的客戶端庫這是我第一次迅速和谷歌應用程序引擎的經驗。撥打國際長途的iOS斯威夫特項目
我創建了一個簡單的java後臺,做了一個發現文檔,使用服務生成器(新的REST服務生成器)來創建客戶端庫,添加了所有谷歌,specfic客戶端庫。
我不能在查詢中通過編譯器錯誤..
這裏是代碼:
let service: GTLRHelloworldService = GTLRHelloworldService()
//no compiler problem with this line.
//my GTLRHellowworldService is included through the bridging headers
service.isRetryEnabled = true
set myquery: GTLRHelloworldQuery_GreetingsEstablishHandShake = GTLRHelloworldQuery_GreetingsEstablishHandShake.query()
service.executeQuery(myquery) { (ticket:GTLRServiceTicket, resp:GTLRHelloworld_HelloGreeting, error: NSError) in
nameLabel.text = resp?.message
}
的錯誤是在最後一行:
無法將類型的價值「 (GTLRServiceTicket,GTLRHelloworld_HelloGreeting,NSError) - >()'到期望的參數類型'GTLRServiceCompletionHandler?'
爲了您的信息GreetingsEstablishHandShake定義由servicegnerator創建的頭文件是:
/**
* GTLRHelloworldQuery_GreetingsEstablishHandShake
*
* Method: helloworld.greetings.establishHandShake
*
* Authorization scope(s):
* @c kGTLRAuthScopeHelloworldUserinfoEmail
*/
@interface GTLRHelloworldQuery_GreetingsEstablishHandShake : GTLRHelloworldQuery
// Previous library name was
// +[GTLQueryHelloworld queryForGreetingsEstablishHandShake]
/**
* Fetches a @c GTLRHelloworld_HelloGreeting.
*
* @returns GTLRHelloworldQuery_GreetingsEstablishHandShake
*/
+ (instancetype)query;
@end
,並在頭文件中的HelloGreeting對象是:
@interface GTLRHelloworld_HelloGreeting : GTLRObject
@property(nonatomic, copy, nullable) NSString *message;
@end