i download the code for facebook integration…and my application work fine..
i just wants to know that what is difference between session and _session
and also loginDialog and _loginDialog
thanks for help…:)
@interface MyFbViewController :UIViewController <FBSessionDelegate, FBRequestDelegate>
{
FBSession* _session;
FBLoginDialog *_loginDialog;
}
@property (nonatomic, retain) FBSession *session;
@property (nonatomic, retain) FBLoginDialog *loginDialog;
@end
in MyFbViewController.m file………
@synthesize session = _session;
@synthesize loginDialog = _loginDialog;
_sessionand_loginDialogare instance variables of the class. As such you are completely responsible for memory management (i.e. retaining and releasing) those variables as you would be with any other variable.The properties session and loginDialog in combination with the
synthesizestatement generate two class properties, which in turn are only special selectors.@synthesize session = _session;basically generates two methods,- (FBSession *)session;and- (void)setSession:(FBSession *)newSession;which are invoked whenever you use the dot-notation for object properties (i.e.object.session). You could write them on your own and leave out the synthesize but that is seldomly done because you again would be responsible for memory management.As these properties are
retainproperties, the automatically generated methods handle the necessary retain/release stuff and could look something like this:Which frees you from the burden of memory management as long as you set the property to
nilwhen done (as this will release any existing object).