gpt4 book ai didi

java - ParseObject.pinAllInBackground() 结果与 NullPointerException

转载 作者:行者123 更新时间:2023-11-29 21:01:29 26 4
gpt4 key购买 nike

我有一个扩展 ParseObject 类的 News 对象。我希望将其缓存在本地,以便稍后从本地存储中获取它。

这是我的回调,包括对 .pinAllInBackground(..) 方法的调用:

    FindCallback<News> onNewsReceived = new FindCallback<News>() {

@Override
public void done(List<News> arg0, ParseException arg1) {

if (arg1 == null) {

newsList = new ArrayList<News>(arg0);
ParseObject.pinAllInBackground(newsList);
initializeList();


} else {
Log.d("TAG1", String.valueOf(arg1.getMessage()));
}

}
};

当我运行它时,出现以下异常:

    09-22 11:31:25.637: E/AndroidRuntime(27380): FATAL EXCEPTION: main
09-22 11:31:25.637: E/AndroidRuntime(27380): Process: pl.holdapp.osw, PID: 27380
09-22 11:31:25.637: E/AndroidRuntime(27380): java.lang.NullPointerException
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParsePin.getParsePin(ParsePin.java:19)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParsePin.pinAllObjectsAsync(ParsePin.java:44)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParseObject.pinAllAsync(ParseObject.java:3320)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParseObject.pinAllInBackground(ParseObject.java:3417)
09-22 11:31:25.637: E/AndroidRuntime(27380): at pl.holdapp.osw.fragments.NewsFragment$2.done(NewsFragment.java:68)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.FindCallback.internalDone(FindCallback.java:45)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.FindCallback.internalDone(FindCallback.java:31)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.Parse$6$1.run(Parse.java:917)
09-22 11:31:25.637: E/AndroidRuntime(27380): at android.os.Handler.handleCallback(Handler.java:733)
09-22 11:31:25.637: E/AndroidRuntime(27380): at android.os.Handler.dispatchMessage(Handler.java:95)
09-22 11:31:25.637: E/AndroidRuntime(27380): at android.os.Looper.loop(Looper.java:157)
09-22 11:31:25.637: E/AndroidRuntime(27380): at android.app.ActivityThread.main(ActivityThread.java:5356)
09-22 11:31:25.637: E/AndroidRuntime(27380): at java.lang.reflect.Method.invokeNative(Native Method)
09-22 11:31:25.637: E/AndroidRuntime(27380): at java.lang.reflect.Method.invoke(Method.java:515)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
09-22 11:31:25.637: E/AndroidRuntime(27380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
09-22 11:31:25.637: E/AndroidRuntime(27380): at dalvik.system.NativeStart.main(Native Method)

arg0 不为空,因此我完全不明白这是从哪里来的。

最佳答案

显然我在固定之前没有调用 Parse.enableLocalDatastore(context);

关于java - ParseObject.pinAllInBackground() 结果与 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25970861/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com