1

i want to show a alert message before composing SLComposeViewController in my App , how to check whether user entered his facebook details in iphone setting before composing SLComposeViewController in ios 6 .

Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70

2 Answers2

4
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]

Returns a Boolean value indicating whether the service is accessible and at least one account is set up.

msk
  • 8,885
  • 6
  • 41
  • 72
  • thank's, but this will check only service type , it won't check whether user has entered his login info in settings or not . it will return true if user have not entered his facebook login credentials also.... – Shaik Riyaz Mar 28 '13 at 12:30
  • it will return true only if at least one account is set up in settings ? That means user has entered his FB credentials. Is it not what you are looking for ? – msk Mar 28 '13 at 14:02
  • It doesn't work on iOS 6 - YES is returned without setted up twitter/facebook account. In iOS 7 this method is fixed. – Sound Blaster Jun 19 '14 at 14:12
3
i have figured this out . . . 

self.myStore = [[ACAccountStore alloc] init];
    ACAccountType *acct = [self.myStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
    NSArray *fbAccounts = [self.myStore accountsWithAccountType:acct];

    // Check to make sure the user has a FB account setup, or bail:
    if ([fbAccounts count] == 0) {
        userDoesNotHaveFBAccountSetup = YES;
        self.fbSwitch.enabled = NO;
        [[self fbSwitch] setOn:NO];
        [self viewDidLoad];
    } else {
        userDoesNotHaveFBAccountSetup = NO;
        self.fbSwitch.enabled = YES;
    }
Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70