0
我在我的应用程序的用户的Facebook墙上发布了一些故事。它的工作正常,但我想知道是否有其他用户想在我的应用程序与其他Facebook帐户登录他怎么能做到这一点。我的意思是我如何注销现有的用户并允许其他用户登录。我在AppDelegate的代码是:如何在您的应用的Facebook上登录其他用户?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
facebook = [[Facebook alloc] initWithAppId:@"app_id"];
NSArray* permissions = [[NSArray arrayWithObjects:
@"publish_stream", nil] retain];
[facebook authorize:permissions delegate:self];
return YES;
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [facebook handleOpenURL:url];
}
和我DetailViewController代码:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
[sTitle stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], @"name",
[sSummary stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], @"description",
[sLink stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"XXX", @"api_key",
@"Share on Facebook", @"user_message_prompt",
attachmentStr, @"attachment",
nil];
[appDelegate.facebook dialog:@"stream.publish" andParams:params andDelegate:self];
一旦应用程序被安装,它要求为Facebook用户名和密码。然后它仅向该用户发布故事。如果我想在我的应用程序中更改用户,那该怎么办?我应该在哪里写
[facebook logout:self];