views:

47

answers:

1

Hi everybody, this is the first time I post a question here. Usually, I found help on web for my Iphone projects problems, but here I am REALLY STUCK !

I use the facebook iphone-sdk to post some infos on a user's wall. Everything works fine. But I have a leak memory when I logout with the fbconnect loginbutton.

Here is the code I used in the implementation file for a test :

- (void)viewDidLoad {

    //session facebook
    session = [[FBSession sessionForApplication:@"APP_KEY"
                                                secret:@"SECRET_KEY"
                                                delegate:self] retain];


    //facebook bouton connect
    FBLoginButton *logButton = [[[FBLoginButton alloc] init] autorelease];
    [self.view addSubview:logButton];

    [super viewDidLoad];
}


- (void) session:(FBSession *) session didLogin:(FBUID) uid {
    NSLog(@"login ok");
}

- (void)sessionDidLogout:(FBSession*) session {
    NSLog(@"didLogOut called");
}

as you see I did nothing. So when I test this app, I push the connect to facebook buton and I log in without problems. But when I push the same button, which is labeled now logout, I log out and then just after that a memory leak appears.

In instruments I can find the origin of the problem and it seams that it is the logout method in FBSession.m file who cause this leak. And especially when the unsave method is called from logout method because if I comment the call, the memory leaks does not appear.

So I need help to figure out what causes this.

A: 

I am a newbie myself but does putting [super viewDidLoad] on top instead of the bottom help? We are adding your session information to the view and we expect it to be added after all the parent class views are loaded.

Nithin
Yeah, viewDidLoad should be put on top but I don't think that it is likely to cause problems here.
vodkhang