升级我的应用程序。目标是iOS5.1。 Xcode 4.5.2以及使用FacebookSDK 3.0和Twitter框架。 应用程序正在登录Facebook没有问题。当我尝试发布一个帖子,我得到这个返回的日志中:iOS:Facebook错误“缺少消息或附件”
2012-12-18 10:39:31.934 MyApp[31754:1d603] Error Domain=com.facebook.sdk Code=5
"The operation couldn’t be completed. (com.facebook.sdk error 5.)"
UserInfo=0xab74630 {com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) Missing message or attachment";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:HTTPStatusCode=400}
2012-12-18 10:39:31.935 MyApp[31754:1d603] (null)
最后一行是一个数表达列出“postParams”在下面列出的“publishStory”方法的结果。请注意它是(null)。 模拟器中的错误结果是“错误:域= com.facebook.sdk,代码= 5”
我使用Facebook教程来构建FB接口。正如本教程所示,我已经列出了initWithNibName中列出的参数。
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// this stuff will change... just get it working
self.postParams = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
@"Share...", @"message",
@"http://MyApp.com", @"link",
@"icon.png", @"picture",
@"MyApp", @"name",
@"A wonderful way to record your life events.", "caption",
@"Easy to use.", @"description",
nil];
}
return self;
}
然后,“发布”是在一个单独的方法,这是它停止,我得到上述错误。
- (void)publishStory
{
[FBRequestConnection
startWithGraphPath:@"me/feed"
parameters:_postParams
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
NSString *alertText;
if (error) {
NSLog(@"%@",error);
NSLog(@"%@", _postParams);
alertText = [NSString stringWithFormat:
@"error: domain = %@, code = %d",
error.domain, error.code];
} else {
alertText = [NSString stringWithFormat:
@"Posted action, id: %@",
[result objectForKey:@"id"]];
}
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}];
}
我认为,实际参数没有被上传。我一直在寻找几天试图找到解决方案。 任何人都有如何解决这个问题,并获得完成后的想法?任何帮助将不胜感激!