Android 解析FetchIfRequired()不起作用

Android 解析FetchIfRequired()不起作用,android,parse-platform,Android,Parse Platform,我的表“攻击”中有2个指针对象(指向ParseUser)。这些指针对象似乎需要一段时间才能检索到。因此,我的代码直接不起作用,给了我一个异常: java.lang.IllegalStateException: ParseObject has no data for this key. Call fetchIfNeeded() to get the data. 然后,我使用try-catch块对fetchIfNeeded函数进行了必要的修改: ParseObject battle = nul

我的表“攻击”中有2个指针对象(指向ParseUser)。这些指针对象似乎需要一段时间才能检索到。因此,我的代码直接不起作用,给了我一个异常:

 java.lang.IllegalStateException: ParseObject has no data for this key.  Call fetchIfNeeded() to get the data.
然后,我使用try-catch块对fetchIfNeeded函数进行了必要的修改:

ParseObject battle = null;
try {
   battle = objects.get(0).fetchIfNeeded();
} catch (ParseException e1) {
   // TODO Auto-generated catch block
   e1.printStackTrace();
}
ParseUser attacker1 = battle.getParseUser("Attacker");
Log.i("dontest",attacker1.getUsername());
它仍然返回相同的值。我甚至用
isDataAvailable
函数检查了它,结果返回true。有什么办法解决这个问题吗

p.S.:我的查询只返回一行,我用
size()
函数检查了这一行


下面是描述fetchIfNeeded()函数的步骤。

像这样使用查询

ParseQuery<ParseObject> pQueryFromAttack = new ParseQuery<ParseObject>("Attack");
// use include to fetch details while quering----increase loading speed by doing this.
pQueryFromAttack.include("pointer to _user table");
List<ParseObject> listObj = pQueryFromAttack.find();

像这样使用它…

像这样使用您的查询

ParseQuery<ParseObject> pQueryFromAttack = new ParseQuery<ParseObject>("Attack");
// use include to fetch details while quering----increase loading speed by doing this.
pQueryFromAttack.include("pointer to _user table");
List<ParseObject> listObj = pQueryFromAttack.find();
像这样使用它