2016-09-09 52 views
0

我剛剛開始學習Swift,並且實施了Google爲我們創建日曆的示例代碼。不過,我也想知道如何註冊一個帳戶切換到另一個日曆,但我似乎無法弄清楚。有人能給我一些指點嗎?Swift Google日曆帳戶登出

感謝您的幫助提前! :-)

+0

你可以幫我谷歌日曆迅速@Tim –

回答

0

谷歌文檔有OAuth的2.0 revoking a token guide

可以使用HTTP/REST使用要求:

curl https://accounts.google.com/o/oauth2/revoke?token={token} 

如果你不熟悉斯威夫特HTTP請求,使用NSURLConnection嘗試this thread以下指南。

let url = NSURL(string: "https://accounts.google.com/o/oauth2/revoke?token={token}") 

let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in 
    print(NSString(data: data!, encoding: NSUTF8StringEncoding)) 
} 

task.resume() 
+0

這樣的工作與示例代碼谷歌給我們?我之前沒有在我的代碼中使用任何NSURL:o – Tim

+0

如果您不嘗試,您永遠不會知道。 – noogui