use*_*906 4 iphone sdk facebook objective-c ios
我试图通过Facebook使用facebook iOS SDK发送应用程序请求,我使用以下代码:
NSString *message = [[NSString alloc] initWithFormat:@"blah blah blah"];
NSString *data = [[NSString alloc] initWithFormat:@"blah blah blah"];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:message, @"message", data, @"data", nil];
[_facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/apprequests",userID] andParams:params andHttpMethod:@"POST" andDelegate:self];
[message release];
[data release];
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
Error: Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x788c5b0 {error=<CFBasicHash 0x788c080 [0x1bf53e0]>{type = mutable dict, count = 2,
entries =>
2 : <CFString 0x788b560 [0x1bf53e0]>{contents = "type"} = <CFString 0x788c3f0 [0x1bf53e0]>{contents = "OAuthException"}
3 : <CFString 0x788c560 [0x1bf53e0]>{contents = "message"} = <CFString 0x788c480 [0x1bf53e0]>{contents = "(#200) Invalid Request: There was a problem with the parameters of the request. Body of an error/warning message. Title is: Invalid Request"}
}
Run Code Online (Sandbox Code Playgroud)
那么有没有人成功用这个,或者你知道一种使用facebook iOS SDK向facebook用户发送请求的方法吗?
谢谢
您可以使用Facebook SDK轻松发送应用程序请求
如需制作应用程序请求请确保执行以下步骤
1)确保在应用程序文件夹中添加了最新的Facebook SDK
如果没有,你可以从下载该链接.
现在,您只需在项目文件夹中添加FBConnect文件夹即可.
2)然后确保您已将您的iphone应用程序注册为"Facebook上的应用程序"类型在"基本应用程序设置"下选择您的应用程序如何与Facebook集成.
如果没有,你可以在这里做.
NSString *friendId=@"FacebookId Of Your Friends";
NSLog(@"%@",friendId);
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Hi please add me as a friend.", @"message",
friendId, @"to",
nil];
[appDelegate.facebook dialog:@"apprequests" andParams:params andDelegate:self];
Run Code Online (Sandbox Code Playgroud)
请不要忘记在ViewController类中首先采用FBdialogDelegate协议.
| 归档时间: |
|
| 查看次数: |
12752 次 |
| 最近记录: |