其他分享
首页 > 其他分享> > 启用固定功能后,无法解析本地数据存储区和ParseQueryAdapter

启用固定功能后,无法解析本地数据存储区和ParseQueryAdapter

作者:互联网

刚刚尝试了我的应用程序中的新本地数据存储功能,并且启用了固定功能后,它一直崩溃告诉方法不允许

具体来说,一旦我设置了适配器listView.setAdapter(mAdapter),它就会崩溃.

由于LogCat没有提供太多线索,我花了一些时间将ParseQueryAdapter定位为问题.

因此,无法将ParseQueryAdapter与启用的本地数据存储一起使用吗?

除非另有说明,否则文档中没有提及,除非使用缓存进行查询.

我持有listview的片段的onCreateView:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_circuit_select,
            container, false);

    ButterKnife.inject(this, rootView);
    mAdapter = new SelectMyCircuitAdapter(getActivity(),
            new SelectedCallback() {

                @Override
                public void circuitSelected(Circuit circuit) {
                    mSelectedCircuit = circuit;
                    startButton.setEnabled(true);
                }
            });

    listView.setAdapter(mAdapter); // <- HERE
    return rootView;
}

SelectMyCircuitAdapter的构造函数:

public SelectMyCircuitAdapter(Context context,
        SelectedCallback circuitSelectedCallback) {
     super(context, Circuit.class);
    this.mCircuitSelectedCallback = circuitSelectedCallback;
}

最后是LogCat:

05-05 20:00:15.975: E/AndroidRuntime(1910): FATAL EXCEPTION: main
05-05 20:00:15.975: E/AndroidRuntime(1910): java.lang.IllegalStateException: Method not allowed when Pinning is enabled.
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.parse.ParseQuery.checkPinningEnabled(ParseQuery.java:595)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.parse.ParseQuery.getCachePolicy(ParseQuery.java:620)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.parse.ParseQueryAdapter$3.done(ParseQueryAdapter.java:351)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.parse.FindCallback.internalDone(FindCallback.java:45)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.parse.FindCallback.internalDone(FindCallback.java:31)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.parse.Parse$5$1.run(Parse.java:887)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at android.os.Handler.handleCallback(Handler.java:725)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at android.os.Handler.dispatchMessage(Handler.java:92)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at android.os.Looper.loop(Looper.java:137)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at android.app.ActivityThread.main(ActivityThread.java:5039)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at java.lang.reflect.Method.invokeNative(Native Method)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at java.lang.reflect.Method.invoke(Method.java:511)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-05 20:00:15.975: E/AndroidRuntime(1910):     at dalvik.system.NativeStart.main(Native Method)

解决方法:

Parse Android Changelog

v1.5.1 — May 30, 2014

Fixed various bugs with Local
Datastore.

我遇到了类似的问题,但今天它已通过新的Parse Android SDK 1.5.1版本的发布得到修复,您应该将其检出并重试.

标签:parse-platform,android
来源: https://codeday.me/bug/20191121/2054333.html