解析本地数据存储和ParseQueryAdapter造成不允许的方法时启用钉扎 [英] Parse local datastore and ParseQueryAdapter causing Method not allowed when pinning is enabled
问题描述
刚刚尝试了新的本地数据存储功能,在我的应用程序,它不停地告诉崩溃不允许的方法时,锁定特性
特别是当我设置适配器崩溃 listView.setAdapter(mAdapter)
。
我花了一些时间来找到ParseQueryAdapter的问题,因为LogCat中并没有提供多少线索。
因此,它是不可能与具有启用本地数据存储在一起使用ParseQueryAdapter?
的文档已经没有另外提及,除了具有与高速缓存查询是不允许的。
我的片段持有的ListView的onCreateView:
@覆盖
公共查看onCreateView(LayoutInflater充气器,容器的ViewGroup,
捆绑savedInstanceState){
查看rootView = inflater.inflate(R.layout.fragment_circuit_select,
集装箱,FALSE); ButterKnife.inject(这一点,rootView);
mAdapter =新SelectMyCircuitAdapter(getActivity()
新SelectedCallback(){ @覆盖
公共无效circuitSelected(电路电路){
mSelectedCircuit =电路;
startButton.setEnabled(真);
}
}); listView.setAdapter(mAdapter); //< - 这里
返回rootView;
}
SelectMyCircuitAdapter的构造:
公共SelectMyCircuitAdapter(上下文的背景下,
SelectedCallback circuitSelectedCallback){
超(背景下,Circuit.class);
this.mCircuitSelectedCallback = circuitSelectedCallback;
}
和最后的LogCat中:
20 05-05:00:15.975:E / AndroidRuntime(1910年):致命异常:主要
05-05 20:00:15.975:E / AndroidRuntime(1910年):java.lang.IllegalStateException:法被启用时,钢钉不允许。
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.parse.ParseQuery.checkPinningEnabled(ParseQuery.java:595)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.parse.ParseQuery.getCachePolicy(ParseQuery.java:620)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.parse.ParseQueryAdapter $ 3.done(ParseQueryAdapter.java:351)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.parse.FindCallback.internalDone(FindCallback.java:45)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.parse.FindCallback.internalDone(FindCallback.java:31)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.parse.Parse $ 5 $ 1.run(Parse.java:887)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在android.os.Handler.handleCallback(Handler.java:725)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在android.os.Handler.dispatchMessage(Handler.java:92)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在android.os.Looper.loop(Looper.java:137)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在android.app.ActivityThread.main(ActivityThread.java:5039)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在java.lang.reflect.Method.invokeNative(本机方法)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在java.lang.reflect.Method.invoke(Method.java:511)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-05 20:00:15.975:E / AndroidRuntime(1910年):在dalvik.system.NativeStart.main(本机方法)
解析Android的更新日志
V1.5.1 - 2014年5月30日
修正各种错误与本地
数据存储。
块引用>我也有类似的问题,但它今天固定的新解析Android SDK中1.5.1版的发布,你应该看看,然后再试一次。
Just tried the new Local Datastore feature in my app and it kept crashing telling
Method not allowed when pinning is enabled
Specifically it crashes as soon as I set the adapter
listView.setAdapter(mAdapter)
.It took me some time to locate ParseQueryAdapter as the problem since the LogCat does not give much clues.
So is it not possible to use a ParseQueryAdapter together with having local datastore enabled?
The documentation have not mentioned otherwise, other than having queries with cache is not allowed.
The onCreateView of my fragment holding listview:
@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; }
The constructor of SelectMyCircuitAdapter:
public SelectMyCircuitAdapter(Context context, SelectedCallback circuitSelectedCallback) { super(context, Circuit.class); this.mCircuitSelectedCallback = circuitSelectedCallback; }
And finally the 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.
I had a similar problem but it was fixed today with the release of the new Parse Android SDK version 1.5.1, you should check it out and try again.
这篇关于解析本地数据存储和ParseQueryAdapter造成不允许的方法时启用钉扎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!