[英]Codename One application works on simulator and Android but crashes on iPad and iphones
My codename one app, works fine on Android and on the simulator, but on my iPad it doesn't. 我的代号为一个应用程序,在Android和模拟器上工作正常,但在我的iPad上却没有。 I've tested on iPad and iPhone devices, and it crashes.
我已经在iPad和iPhone设备上进行了测试,它崩溃了。
On the iPad (iPad3,4), I see JetsamEvent
events generated after the crash. 在iPad(iPad3,4)上,我看到崩溃后生成的
JetsamEvent
事件。
This answer seems to indicate that it is a memory problem, but I'm experiencing the issue only on Apple devices (iPad and iPhone). 这个答案似乎表明这是一个内存问题,但我只在Apple设备(iPad和iPhone)上遇到这个问题。
Anyone have any suggestion to manage or improve the memory of my app? 任何人都有任何建议来管理或改善我的应用程序的内存?
In all kind of Android devices that I tested, the application never crashed like this. 在我测试的所有类型的Android设备中,应用程序从未像这样崩溃。
The crash is always aleatory. 崩溃总是很随意。 After the crash, I repeat the same actions and it doesn't crash.
崩溃后,我重复相同的操作,它不会崩溃。 It's totally random.
这完全是随机的。
Thanks in advance. 提前致谢。
像这样的崩溃报告没什么可做的,我建议使用Log
类来跟踪崩溃实际发生的位置,并使用消除过程来确定哪个代码片段导致崩溃。
After a lot of test, I find out that the problem is in the mapResponse object and how it works in the iOS systems. 经过大量的测试,我发现问题出在mapResponse对象中,以及它在iOS系统中的工作原理。 If the mapResponse is small, you can do this:
String resResponse=(String)mapResponse.get("RES");
如果mapResponse很小,你可以这样做:
String resResponse=(String)mapResponse.get("RES");
with no problem in iOS. 在iOS中没有问题。
But if the response is big (4000 characters for example), the mapResponse.get("RES")
is not a true String. 但是如果响应很大(例如4000个字符),则
mapResponse.get("RES")
不是真正的String。 Only work with that false String object crash the application, for example: 仅使用该假String对象使应用程序崩溃,例如:
if (resResponse != null && resResponse.startsWith("SUP"))
So I have to check if the mapResponse Object is String or not like this: 所以我必须检查mapResponse对象是否是字符串,如下所示:
isError=(objResp instanceof String)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.