I am following this tutorial
https://parse.com/docs/ios_guide#twitterusers/iOS
For this app, I'm doing a sign in with Twitter deal. There's one problem. If a user is not signed into twitter (they didn't sign in from settings), nothing is displayed when this code runs:
[PFTwitterUtils logInWithBlock:^(PFUser *user, NSError *error) {
if (!user) {
NSLog(@"Uh oh. The user cancelled the Twitter login.");
return;
} else if (user.isNew) {
NSLog(@"User signed up and logged in with Twitter!");
} else {
NSLog(@"User logged in with Twitter!");
}
}];
I am wondering if there is a way to check if a user is signed in from settings so I can set up a message saying they should sign in from settings. Does anyone know a way to check this?
You can just check if the service is available and if not then do whatever. And this is checking that there is an account in Settings|Twitter
This is in Swift but you get the idea
Swift 3
Returns
No logged in user: nil
Logged in user: TWTRSession
Swift 4
I am using TwitterKit and installed it with cocoapod Twitterkit has sessionstore which stores session for the logged in users.
For logout from twitter
This is how to get information about logged in user