socona
socona

Reputation: 452

CN1: ios app crashes when showing picker component

My CN1 app crashes on iOS only (not on android). With the native sources and xcode I found the error location:

The error comes up when a form is shown which includes a Picker-component.

In xcode I found that this line in my code is causing the error: picker.setType(Display.PICKER_TYPE_STRINGS);

My code:

private boolean setPicker() {
        picker.remove();
        picker.setSelectedString(null);
        picker.setType(Display.PICKER_TYPE_STRINGS);
        String[] arr = RatingObject.getListAsStringArray();
        if (arr.length > 0) {
            gui_ro_Picker.setStrings(arr);
        .....

Error:

Thread 5: EXC_BAD_ACCESS (code=1, address=0x0)

Code where the error appears:

#ifdef NEW_CODENAME_ONE_VM
JAVA_BOOLEAN com_codename1_impl_ios_IOSImplementation_instanceofObjArrayI___java_lang_Object_R_boolean(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT n1)
{
    // second part of the expression check that this isn't a primitive array
    return n1->__codenameOneParentClsReference->isArray && cn1_array_start_offset + 100 < n1->__codenameOneParentClsReference->classId;
}

xcode marks explicitly the return line with the error

Do you have any advice on this?

Update:

Moving picker.setType(Display.PICKER_TYPE_STRINGS); into the constructor solved the issue.

Upvotes: 2

Views: 55

Answers (1)

socona
socona

Reputation: 452

For me moving picker.setType(Display.PICKER_TYPE_STRINGS) into the constructor solved this issue.

Thanks for the advices!

Upvotes: 1

Related Questions