When running with the debugger (in Xcode) it will stop on these error. When running normally, it "catches" them and proceeds.
((AppData)appData.get()).appVersion That doesn't look safe. You say appData is a weak reference? Then get() may return null? Then the .appVersion will be an NPE, which is essentially what you're seeing. On Sun, May 2, 2021 at 11:27 PM 'P5music' via CodenameOne Discussions < [email protected]> wrote: > > I compiled my app with maven and generated the iOS Xcode project. > When I run it into the iOS simulator (iPad 8th gen) I get this early error: > Thread 4: EXC_BAD_ACCESS (code=1, address=0x30) > at this instruction > return (*(struct > obj__com_myapp_app_AppData*)__cn1T).com_myapp_app_AppData_appVersion; > Where only the .com_myapp_app_AppData_appVersion part is in red. The iOS > build code is below. > > It happens at > ((AppData)appData.get()).appVersion > Inside AppJSONData class, that has a weak reference to the AppData > instance. > That seems to be a CodenameOne internal problem, not of my app, because it > does not happen either on the simulator, or on Android, or a real iOS > device (32bit). > Am I right? > What’s happening. How can it be avoided? Should weak references be > avoided? I think this one can be removed because it has the same app > lifetime, but there are also others that are dynamic. > Also it can be something that is wrong in the CN1 maven system to be fixed. > Thanks in advance > > #include "com_myapp_app_AppData.h" > #include "com_myapp_app_AppData.h" > #include "com_myapp_app_AppJSONData.h" > #include "java_io_IOException.h" > #include "java_lang_NullPointerException.h" > #include "java_lang_String.h" > #include "java_lang_ref_WeakReference.h" > const struct clazz *base_interfaces_for_com_myapp_app_AppData[] = {}; > struct clazz class__com_myapp_app_AppData = { > DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, > &__FINALIZER_com_myapp_app_AppData ,0 , &__GC_MARK_com_myapp_app_AppData, > 0, cn1_class_id_com_myapp_app_AppData, "com.myapp.app.AppData", 0, 0, 0, > JAVA_FALSE, &class__java_lang_Object, > base_interfaces_for_com_myapp_app_AppData, 0, 0, 0 > , 0, 0, 0, 0, 0, 0}; > > JAVA_OBJECT get_field_com_myapp_app_AppData_appVersion(JAVA_OBJECT __cn1T) > { > return (*(struct > obj__com_myapp_app_AppData*)__cn1T).com_myapp_app_AppData_appVersion; > } > > -- > You received this message because you are subscribed to the Google Groups > "CodenameOne Discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/codenameone-discussions/c0d25bdf-85a4-4253-ade1-fcaed6c484dbn%40googlegroups.com > <https://groups.google.com/d/msgid/codenameone-discussions/c0d25bdf-85a4-4253-ade1-fcaed6c484dbn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Steve Hannah Software Developer Codename One http://www.codenameone.com -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKWV%2B1nUK1r464nfgYXarULqpyBL60qh7CWEG5O%3DS4wjrA%40mail.gmail.com.
