问题
I am using version 5.0 of BBplugin in eclipse and the FB jar lib ( FacebookBlackBerrySDK-v0.8.25.jar ) i get an error API error code :11 API Error Description : This method is deprecated Error Message: Display=wap dialogs have have been deprecated . You can temporarily enable them by disabling the "july_2012" migration.They will stop working permanently on july 1,2012.
http://supportforums.blackberry.com/t5/Java-Development/FaceBook-API-error-code-11-Method-Deprecated/td-p/1671793
I checked out this link .. But it isn't giving the solution
I tried out for july 2012 migration solution only i have not tried the solution display=wap into display=touch
as i don't know where it is
i get the following error when i run it on simulator
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();
}
}
}
Above is my code Please check out
回答1:
Check your app setting on facebook. and in Migrations disable last three options(July 2012 Breaking Changes, Include Checkins with Statuses, August 2012 Breaking Changes).Hope it will help you :)
来源:https://stackoverflow.com/questions/10515924/getting-facebook-error-11