Search code examples
iosfacebookfacebook-loginslcomposeviewcontroller

how to check whether user entered his facebook details in iphone setting before composing SLComposeViewController in ios 6


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 .


Solution

  • 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;
        }