Facebook操作不会在发布时使用android指定任何引用对象
我的行动是“寻找”。对象是:“瓦伦丁”。但是在属性字段中,我的对象的名称是“Reference”类型的“valentine” 现在,我正在尝试使用ANDROID发布“查找”操作,该操作会显示错误消息: “您试图发布的操作无效,因为它未指定任何引用对象。必须至少指定以下属性之一:valentine\ux” 我的代码:Facebook操作不会在发布时使用android指定任何引用对象,android,facebook,facebook-graph-api,facebook-opengraph,Android,Facebook,Facebook Graph Api,Facebook Opengraph,我的行动是“寻找”。对象是:“瓦伦丁”。但是在属性字段中,我的对象的名称是“Reference”类型的“valentine” 现在,我正在尝试使用ANDROID发布“查找”操作,该操作会显示错误消息: “您试图发布的操作无效,因为它未指定任何引用对象。必须至少指定以下属性之一:valentine\ux” 我的代码: private interface ValentineGraphObject extends GraphObject{ public String getUrl();
private interface ValentineGraphObject extends GraphObject{
public String getUrl();
public void setUrl(String url);
public String getId();
public void setId(String id);
}
private interface FindAction extends OpenGraphAction{
// The valentine object
public ValentineGraphObject getValentine();
public void setValentine(ValentineGraphObject valentine_);
}
protected void populateOGAction(OpenGraphAction action) {
FindAction findaction = action.cast(FindAction.class);
ValentineGraphObject valentine_ =GraphObject.Factory.create(ValentineGraphObject.class);
valentine_.setUrl("http://milliondollarsapps.com/Kunal/valen.html");
findaction.setValentine(valentine_);
}
有人能帮我吗。
如能迅速提供帮助,将不胜感激。
谢谢这里的问题是FindAction界面上的属性(即setValentine,并被翻译为“valentine”)与OG操作中的属性(即“valentine”)不匹配 有两种方法可以解决此问题: a。不要使用findaction.setValentine(…),请执行以下操作: b。在setValentine方法上使用PropertyName注释:
private interface FindAction extends OpenGraphAction{
// The valentine object
public ValentineGraphObject getValentine();
@PropertyName("valentine_")
public void setValentine(ValentineGraphObject valentine_);
}
没有人知道这个问题的答案吗?谢谢李明的回答。我尝试了第二种方法,但仍然显示出相同的错误。对于第一种方法,我得到了FaceBookGraphBojectAction。I set:findaction.setProperty(字符串s,ValentineGraphObject);请提供您对此的意见。感谢我得到的第一个:FacebookgraphobjectactionException:Factory无法代理方法findaction.setProperty(字符串s,ValentineGraphObjectValentine);当我再次尝试时,第二种方法奏效了。。。非常感谢李明:)
private interface FindAction extends OpenGraphAction{
// The valentine object
public ValentineGraphObject getValentine();
@PropertyName("valentine_")
public void setValentine(ValentineGraphObject valentine_);
}