In iOS 6, check if a person is logged in to a social network?

做~自己de王妃 提交于 2020-01-02 05:34:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!