使用处理程序和to库将状态更新到Facebook,但我遇到了以下错误:“类型Post是模棱两可的”,这一行似乎是突出显示的原因“postChoreo =新的Post(会话);”。任何关于如何解决这一问题的建议都将是极好的。
import com.temboo.core.*;
import com.temboo.Library.Facebook.Publishing.*;
// Create a session using your Temboo account application details
TembooSession session = new TembooSession("dylabaloo", "myFirstApp",
"xxxxxxxxxxxxxxxxxxxx");
void setup() {
// Run the Post Choreo function
runPostChoreo();
}
void runPostChoreo() {
// Create the Choreo object using your Temboo session
Post postChoreo = new Post(session);
// Set inputs
postChoreo.setAccessToken("xxxxxxxxxxxxxxxxxx");
postChoreo.setMessage("Your High Score is:");
// Run the Choreo and store the results
PostResultSet postResults = postChoreo.run();
// Print results
println(postResults.getResponse());
}发布于 2015-05-19 03:36:02
只要看一看代码和所得到的错误,我猜Post类可能同时存在于com.tembo.core.*包中,也可能存在于com.tembo.Library ary.Facebook.Publission.*包中,也可能存在于编写类的同一个包中。
我想您正在尝试使用Facebook发布帖子,因此您应该导入如下文章,以避免歧义。进口com.temboo.Library.Facebook.Publishing.Post;
使用通配符导入不是一个好主意。首先,您将遇到这样的问题,因为使用通配符导入的多个包中可能存在相同的类名。其次,它只是太多不必要的类进口。第三,这不是一个好的编码实践。
大多数IDE,特别是所有基于eclispe的IDE,提供了简单的快捷方式来组织导入(比如Ctrl O for windows),这可以帮助您组织您的导入并避免此类问题。
https://stackoverflow.com/questions/30316104
复制相似问题