简体   繁体   中英

facebook ios sdk log : strange message

I've got a button to share an image and every times I click it, I've got this message in the log, I dont understand :

2012-08-12 19:21:30.511 AvisOcean[2239:707] An instance 0xe6b8fe0 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: ( Context: 0xa5e90, Property: 0x245310> Context: 0xa5e90, Property: 0x28c400> )

Any ideas?

The Facebook SDK is leaking observers. I am using SDK v3.1.

This shouldn't be an issue if you are using the SDK without the deprecated headers (ie Facebook.h). But to use native dialogs you need to include the deprecated headers (source: https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/ ) which leads to this error when closing/cleaning the active session.

Here is a pull request to fix it: https://github.com/facebook/facebook-ios-sdk/pull/474

You can then rebuild the SDK using Facebook SDK for iOS6/Xcode 4.5 not working

I was having the same problem. I think what had happend is I had initialized Facebook else where and it was giving me errors when I tried to re-initialize it and again invoke a dialog delegate from a different instance.

The instance where i was keeping actual app initialization and accesstoken were different from the one which was invoking the dialog. When I corrected that after going over the documentation , it was solved.

if (nil == self.facebook) {
    self.facebook = [[Facebook alloc]
                     initWithAppId:FBSession.activeSession.appID
                     andDelegate:nil];

    // Store the Facebook session information
    self.facebook.accessToken = FBSession.activeSession.accessToken;      
    self.facebook.expirationDate = FBSession.activeSession.expirationDate;
}

[self.facebook dialog:@"feed" andParams:params andDelegate:self];

Do a quick logout prior to assigning accessToken and expirationDate, that will help clean up some nasty error that you had seen. I'm sure this is just a temporary solution for those using deprecated Facebook headers.

// Initiate a Facebook instance
if(!_facebook)
    _facebook = [[Facebook alloc] initWithAppId:FBSession.activeSession.appID andDelegate:nil];

// Store the Facebook session information
[_facebook logout];
_facebook.accessToken = FBSession.activeSession.accessToken;
_facebook.expirationDate = FBSession.activeSession.expirationDate;

I see this message when my Facebook object is dealloc'ed. I'm using the 3.0.8 SDK. In my case I'm thinking that the Facebook object should remove itself as an observer of its tokenCaching before releasing it in its dealloc. Your case might be different since it doesn't sound like you'd be clearing the FB object. Perhaps the suggestions here would help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM