2016-09-09 44 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