尝试发布到朋友墙时OAuthException

Mar*_*101 4 android facebook

我尝试使用Android中的Facebook api发布到朋友的墙上有很多麻烦.这就是我现在所拥有的:

if (facebook.isSessionValid()) {
                        String response = facebook.request((userID == null) ? "me" : userID);

                        Bundle params = new Bundle();
                        params.putString("message", "put message here");
                        params.putString("link", "http://mylink.com");    
                        params.putString("caption", "{*actor*} just posted this!");
                        params.putString("description", "description of my link.  Click the link to find out more.");
                        params.putString("name", "Name of this link!");
                        params.putString("picture", "http://mysite.com/picture.jpg");

                        response = facebook.request(((userID == null) ? "me" : userID) + "/feed", params, "POST");       

                        Log.d("Tests",response);
                        if (response == null || response.equals("") || 
                                response.equals("false")) {
                            Log.v("Error", "Blank response");
                        }
                    } else {
                        // no logged in, so relogin
                        Log.d("1234567890", "sessionNOTValid, relogin");

                    }
                }catch(Exception e){
                    e.printStackTrace();
                }
Run Code Online (Sandbox Code Playgroud)

但是这会返回错误:

12-11 21:34:06.604: D/FACEBOOK RESPONSE(14954): {"error":{"message":"(#200) Feed story publishing to other users is disabled for this application","type":"OAuthException","code":200}}
Run Code Online (Sandbox Code Playgroud)

Jes*_*hen 15

您最近可能创建了这个Facebook应用程序,这意味着2013年2月的重大更改已启用.

二月份的重大变化包括:

删除通过Graph API发布到朋友墙的功能

我们将删除通过Graph API发布到用户朋友的墙上的功能.具体来说,针对[user_id]/feed的帖子,其中[user_id]与会话用户不同,或者stream_publish调用,其中target_id用户与会话用户不同,将失败.如果您想允许人们发布到他们朋友的时间轴,请调用Feed对话框.通过用户提及标记或动作标记包含朋友的故事将显示在朋友的时间线上(假设朋友批准标记).有关详细信息,请参阅此博客文章.

我们禁用此功能在2月开始,如果你想启用它(只是暂时的,直到2月)去你的应用信息中心>设置>高级>禁用"2013年2月重大更改"

我强烈建议不要这样做,但是,自2月开始此功能将导致您的应用再次抛出相同的错误.