简体   繁体   English

iOS上的Facebook身份验证

[英]Facebook Auth on iOS

iOS beginner here. iOS初学者在这里。 I am implementing SSO in my iOS app. 我正在我的iOS应用程序中实现SSO。 I've created a Facebook object with 我创建了一个Facebook对象,

Facebook* facebook = [[Facebook alloc] initWithAppId:appId];
[facebook authorize:permissions delegate:self];

How do I stay logged in after the user closes the app? 用户关闭应用程序后如何保持登录状态? Do I persist this facebook object in Core Data? 我是否将这个facebook对象保留在Core Data中?

You can also use NSUserDefaults , which is what I have used in the past. 您还可以使用NSUserDefaults ,这是我过去使用的。 You only need to persist the expirationDate and accessToken . 您只需要保留expirationDateaccessToken Once you restore those into the Facebook object on launch, you can call isSessionValid to determine that validity of both those properties. 一旦将它们还原到启动时的Facebook对象中,就可以调用isSessionValid来确定这两个属性的有效性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM