Hi,
I have implemented a Facebook Connect feature in my app to publish information to a users wall. This seems to work wonderfully when the app is first launched and the user logs in. However, if the app is left open for a long period of time after the login, the publish page starts to have issues. Instead of the "Publish to your Wall and your friends' home pages?" dialog box coming up like it does when the user first logged in, the window simply opens and quickly closes. If I quit the app and run it again, the user is then asked to log in again and the publish page works.
So, it seems to have to do with some kind of extended login time that I am not handling correctly.
Here is the snippets of the code that I have included (all not relevant code and facebook key is stripped out). Note that I do not have any dealloc statements related to facebook connect (maybe this is the issue):
Code:
.h file
#import <UIKit/UIKit.h>
#import "FacebookAgent.h"
@interface MoreTableController : UITableViewController
<UITableViewDelegate, UITableViewDataSource, FacebookAgentDelegate> {
FacebookAgent* fbAgent;
}
@end
.m file
#import "MoreTableController.h"
@implementation MoreTableController
- (void)viewDidLoad {
fbAgent = [[FacebookAgent alloc] initWithApiKey:@"removed"
ApiSecret:@"removed"
ApiProxy:nil];
fbAgent.delegate = self;
}
- (void)updateStatus{
appDelegate = (ArtistAppDelegate *)[[UIApplication sharedApplication] delegate];
fbAgent.shouldResumeSession =YES;
[fbAgent publishFeedWithName:[appDelegate.data objectAtIndex:39]
captionText:[appDelegate.data objectAtIndex:41]
imageurl:[appDelegate.data objectAtIndex:43]
linkurl:[appDelegate.data objectAtIndex:15]
userMessagePrompt:@"Leave a comment:"
actionLabel:[appDelegate.data objectAtIndex:45]
actionText:[appDelegate.data objectAtIndex:47]
actionLink:[appDelegate.data objectAtIndex:49]];
}
- (void) facebookAgent:(FacebookAgent*)agent requestFaild:(NSString*) message{
fbAgent.shouldResumeSession =NO;
[fbAgent setStatus:@"Status From Anywhere Artist"];
}
- (void) facebookAgent:(FacebookAgent*)agent statusChanged:(BOOL) success{
}
- (void) facebookAgent:(FacebookAgent*)agent loginStatus:(BOOL) loggedIn{
}
@end
Also, I have added the FacebookAgent and FBConnect folder structure from the standard facebook connect package. Please note that the rest of the app continues to function perfectly and doesn't "crash" to any error codes. I don't know if it helps, but occasionally, it takes a long time for the publish page to load all of its data (this may simply be a facebook server thing and a completely separate issue).
Thanks for your help.
James