2

I am using facebook in my ios application to post score.While logging into facebook i check whether facebook account is configured in my iPhone setting, if it is not configured i give a message as "Configure your facebook login in iphone setting". So when the user configures it i get a notification my app by using "ACAccountStoreDidChangeNotification". My problem is this notification is called several times even if user has changed account only once

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sharingStatus) name:ACAccountStoreDidChangeNotification object:nil];

This is how i have registered notification

- (void)sharingStatus {
i give message as account being configured.

}

Can anyone please help me why the notification ACAccountStoreDidChangeNotification is getting called several times. I followed this link Handle ACAccountStoreDidChangeNotification for Facebook & Twitter in iOS 6+ but was not that useful to me. Thank you

2
  • Can you please mention where are you adding the Observer. Faced the same issue. Tried to add observer at application: didFinishLaunchingWithOptions: But still it fired so many times. So i added the observer whenever app goes background before that removing the already added observer.
    – dev4u
    May 8, 2014 at 11:38
  • I couldn't get to make ACAccountStoreDidChangeNotification work. As I understand, I just need to add [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accountChanged:) name:ACAccountStoreDidChangeNotification object:nil]; and the method accountChanged:(NSNotification *)notification right?
    – SleepNot
    May 29, 2014 at 14:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.