问题
Is there a way to check if a user actually is logged in to facebook or twitter in the operating system.
The reason I want to do this is to fall back on sharing in the application by for example using facebooks SDK instead to share, without asking the user to log in again.
I actually thought that the code:
[SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook];
did exactly that, but apparently it only shows an alert if the user has not logged in.
This only occurs when the user does not have the Facebook app installed, is not logged in the operating system (in the settings), but is logged in to our application through the Facebook SDK.
回答1:
What you have works for me on device:
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {// do something only for logged in fb users} else {//do something else for non-fb users}
Are you trying on device or simulator?
回答2:
Unfortunatly you can't check if the user is correctly logged. The facebook password can be incorrect and the method (isAvailableForServiceType) returns true
来源:https://stackoverflow.com/questions/12705559/in-ios-6-check-if-a-person-is-logged-in-to-a-social-network