making login/logout buttons
Is there a recommended way to access sharer attributes to get access to the sessions? I need to have buttons for login/logout of the different sharers, and it would be best if the buttons were connected to what SHK is doing.
For status, you can check [ServiceClassName isAuthorized] to see whether the service has been authorized.
For logout, call [SHK logoutOfService:@"ServiceClassName"].
For login, you can instantiate a sharer and call [sharer authorize] to force the login process. However, if you need notification of the successful login (likely), you'll need to modify the source code. I've posted a working implementation here: #213
How can I know if facebook or twittter session has been started? or is that the same as [ServiceClassName isAuthorized] ? I'd like to know this to enable or disable my logout buttons. Thanks.
See the issue linked in my previous comment (#213). It has code that was included in the main branch that produces notifications. There is an example of use there as well.
Thanks smkiewel, but notifications is not what I'm looking for. I'd like something like this in my viewDidLoad: if (facebook logged) { facebookButton.tittle.text=@"Log Out" } else { facebookButton.tittle.text=@"Log In" }
Maybe isAuthorized is for that, I'm going to try that now. What do you think? Thanks. BTW, how can I put code here? is there any keyword?
Yes, you would do something like:
if ([SHKFacebook isAuthorized]) {
facebookButton.title.text=@"Log Out";
} else {
facebookButton.title.text=@"Log In";
}
Code formatting is done by prepending 4 spaces. See the "Github Flavored Markdown" link at the top right of the comment box.
OK, thanks a lot.
BTW, do you know if ShareKit is still be maintained by his author?