1
我對Facebook的使用這個牆張貼從我的iPhone應用程序iPhone開發獲取用戶的個人資料姓名,電子郵件使用fbconnect API
kAppId [email protected]"zsdgdfgjhjk";
if (!kAppId) {
NSLog(@"missing app id!");
exit(1);
return nil;
}
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
_permissions = [[NSArray arrayWithObjects:
// @"read_stream", @"publish_stream", @"offline_access",@"user_events",@"friends_events",@"rsvp_event",nil] retain];
@"read_stream",@"email", @"publish_stream", @"offline_access",@"user_events",@"friends_events",@"rsvp_event",@"create_event",nil] retain];
_facebook = [[Facebook alloc] initWithAppId:kAppId
andDelegate:self];
- (IBAction)publishStream:(id)sender {
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"a long run", @"name",
@"The Facebook Running app", @"caption",
@"it is fun", @"description",
@"http://itsti.me/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
nil];
[_facebook dialog:@"publish.stream"
andParams:params
andDelegate:self];
}
牆上張貼會不錯,但現在我想獲得用戶的Facebook個人資料名稱加電子郵件這個我想用戶登錄後,該代碼
[_facebook requestWithGraphPath:@"me?fields=id,name,email" andDelegate:self];
和
- (void)request:(FBRequest *)request didLoad:(id)result
{
if ([result isKindOfClass:[NSDictionary class]]){
username = [result objectForKey:@"name"];
}
}
,但它不是w ^甚至連這個簡單的代理方法- (void)request:(FBRequest *)request didLoad:(id)result
,都沒有被調用。指導,我一直在這裏呆了很長時間。提前致謝。問候,薩德。