问题
I'm using the Facebook iOS SDK in my application and i have two similar question:
- Is there any way to know whether or not there is a user currently logged in?
- What i'm using now is storing the access token and expiration date on successful login, and load them when the application start. My question is: If the session is not valid, can i just give the user the option to log in without asking every time for permissions? because right now, every time that i want to login i get the message that i already gave permissions to my app. And I only want to login without this part.
Any ideas?
回答1:
- A call to
graph.facebook.com/mewill return results only in case you have valid auth token. Without an access token you are not logged in, too. - Either request
offline_accessprivilege or just do not use the new login mechanism but a login dialog. The dialog will popover your app and only ask once for privileges.
I'm currently on iPhone, so can not provide code, but have look for the FBDialog methods in SDK.
来源:https://stackoverflow.com/questions/5232063/facebook-ios-sdk-login-to-facebook-without-always-ask-for-permissions-for-the-a