让Facebook出错11

时间:2012-05-09 12:18:22

标签: facebook api blackberry deprecated

我正在使用  eclipse中的BBplugin 5.0版和FB jar lib(FacebookBlackBerrySDK-v0.8.25.jar) 我收到一个错误 API错误代码:11 API错误说明:不推荐使用此方法 错误消息:显示=已弃用wap对话框。您可以通过禁用“july_2012”迁移暂时启用它们。它们将于2012年7月1日永久停止工作。

http://supportforums.blackberry.com/t5/Java-Development/FaceBook-API-error-code-11-Method-Deprecated/td-p/1671793

我看了这个链接.. 但它没有提供解决方案

我只尝试过2012年7月的迁移解决方案 我没有尝试解决方案display = wap into display = touch

因为我不知道它在哪里

我在模拟器上运行时出现以下错误

http://tinypic.com/view.php?pic=191m3o&s=6

import com.blackberry.facebook.ApplicationSettings;
import com.blackberry.facebook.Facebook;
import com.blackberry.facebook.FacebookException;
import com.blackberry.facebook.inf.User;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.container.MainScreen;


public class MyScreen extends MainScreen implements FieldChangeListener{

    private User user;
    String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
    String APPLICATION_ID = "My App id"
    String APPLICATION_SECRET = "My Application Secret";


    String[] PERMISSIONS = Facebook.Permissions.ALL_PERMISSIONS;
    private Facebook fb;
    private ApplicationSettings as;
    private String id="";
    private EditField ef;

    private ButtonField bf;

    public MyScreen(String id ) {

        //      this.user = user;
        this.id = id;

        ef = new EditField("Hi", " ");
        bf = new ButtonField("Publish");
        bf.setChangeListener(this);
        add(ef);
        add(bf);

    }

    private void FBPost(){

        ApplicationSettings as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
        Facebook fb = Facebook.getInstance(as);



        as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
        fb = Facebook.getInstance(as);
        try {

            user = fb.getCurrentUser();
            String result = user.publishStatus(ef.getText());

            if ((result != null) && !result.trim().equals("")) {
                Dialog.inform("Publish Success.");
            } else {
                Dialog.inform("Publish Failed.");
            }
        } catch (FacebookException e) {
            // TODO Auto-generated catch block
            Dialog.inform("Exception in myscreen");
            e.printStackTrace();
        }


    }



    public void fieldChanged(Field field, int context) {

        if(field==bf){

            String text = ef.getText();
            FBPost();

        }

    }
}

以上是我的代码请 看看

1 个答案:

答案 0 :(得分:2)

在Facebook上查看您的应用设置。并在迁移中禁用最后三个选项(2012年7月重大更改,包含状态检查,2012年8月重大更改)。希望它可以帮助您:)