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
,都没有被调用。指导,我一直在这里呆了很长时间。提前致谢。问候,萨德。