For anyone who comes across this question, it appears that Matt's observation does not apply to the newest facebook-iphone-sdk. The parameters are no longer explicitly retained in the relevant method:
+ (FBRequest *)getRequestWithParams:(NSMutableDictionary *) params
httpMethod:(NSString *) httpMethod
delegate:(id<FBRequestDelegate>) delegate
requestURL:(NSString *) url {
FBRequest* request = [[[FBRequest alloc] init] autorelease];
request.delegate = delegate;
request.url = url;
request.httpMethod = httpMethod;
request.params = params;
request.connection = nil;
request.responseText = nil;
So memory management for the delegate falls back to the property declaration in the .h file:
@property(nonatomic,assign) id<FBRequestDelegate> delegate;
This means a crash is now possible since the delegate object can be deallocated before the FBRequest is completed.
Update:
A possible workaround is suggested in this question to allow cancellation of pending FBRequests.
Update 2:
To avoid a crash in the case where the delegate gets deallocated before the FBRequest finishes, you need to cancel the active FBRequest's connection as you deallocate the delegate (which is basically what Matt suggests in the linked question). However (I'm not sure if this is new), you can do this directly to the FBRequest since it exposes it's NSURLConnection property. So, if you retain your FBRequest object in a property:
@property (nonatomic, retain) FBRequest *myRequest;
and save the request object when you make your call:
self.myRequest = [facebookObj requestWithGraphPath:@"me" andDelegate:self];
you can clean everything up in your dealloc:
- (void)dealloc
{
if( myRequest ) {
[[myRequest connection] cancel];
[[myRequest release];
}
...
[super dealloc];
}
Obviously, you should probably also release and nil the FBRequest property in the delegate methods once you have processed the response.