为什么突然间我的iOS应用程序不能将状态更新发布到Facebook [英] Why suddenly my iOS app can not post status update to Facebook

查看:134
本文介绍了为什么突然间我的iOS应用程序不能将状态更新发布到Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过我几天前开发的iOS应用程序向Facebook用户端发布状态更新。然后我可能不小心删除了一些东西,现在我不能发布并收到错误消息。相关代码是A:

  message = @test; 
[FBRequestConnection startForPostStatusUpdate:message
completionHandler:^(FBRequestConnection * connection,id result,NSError * error){
}
  [FBRequestConnection startWithGraphPath:@我/ feed参数:postParams HTTPMethod:@POSTcompletionHandler:^(FBRequestConnection * connection,id result,NSError * error)

我收到相同的错误信息:操作无法完成。 (com.facebook.sdk错误5。)



我也注意到,无论是使用FacebookSDK.h还是Facebook.h,我也想知道为什么FacebookSDK.h足以支持上述两种方法,为什么教程建议不推荐使用Facebook.h。



有趣的是,我去检查另一个测试iOS应用程序,我记得可以发布Facebook状态更新,发现它不能发布任何想法?

解决方案

我决定使用iOS6功能SLComposeViewController,这使得发布Facebook状态更新了一块蛋糕。



在.m文件中添加社交框架后,您可以这样做:

   - (IBAction)clickMe :( UIButton *)发件人{
NSLog(@你点击了我);
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]){

SLComposeViewController * myFB = [S LComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];


SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if(result == SLComposeViewControllerResultCancelled){
NSLog(@cancelled)
} else {
NSLog(@哦yeah);
}
[myFB dismissViewControllerAnimated:YES完成:nil];
};
myFB.completionHandler = myBlock;
[myFB setInitialText:@从我的应用程序发布。];
[self presentViewController:myFB动画:YES完成:nil];

}

}


I was able to post a status update to Facebook user wall through the iOS app I'm developing a few days ago. Then I probably accidentally removed something, I now cannot post and get error message. The relevant code is A:

    message = @"test";
    [FBRequestConnection startForPostStatusUpdate:message
    completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    }

I also tried following method B:

    [FBRequestConnection startWithGraphPath:@"me/feed" parameters:postParams HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection,id result,NSError *error)

and I got same error message: The operation couldn’t be completed. (com.facebook.sdk error 5.)"

I also noticed doesn't matter if I use FacebookSDK.h or Facebook.h for either method, both (four ways) would all get the same error message above. I also wonder why FacebookSDK.h is enough to support two methods above, why the tutorial suggests deprecated Facebook.h.

Interesting, I went to check another testing iOS app that I remember could post Facebook status update, and found it could not post either. Any idea?

解决方案

I decided to use iOS6 feature SLComposeViewController, which makes posting Facebook status update a piece of cake.

After add Social framework in your .m file, you can do sth like this:

    - (IBAction)clickMe:(UIButton *)sender {
         NSLog(@"you clicked me");
         if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

       SLComposeViewController* myFB = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];


          SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result) {
            if (result == SLComposeViewControllerResultCancelled) {
                NSLog(@"cancelled");
           } else {
               NSLog(@"oh yeah");
           }
        [myFB dismissViewControllerAnimated:YES completion:nil];
    };
    myFB.completionHandler = myBlock;
    [myFB setInitialText:@"Posting from my app."];
    [self presentViewController:myFB animated:YES completion:nil];

    }

    }

这篇关于为什么突然间我的iOS应用程序不能将状态更新发布到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆