iOS Question [SOLVED] This class is not key value coding-compliant

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi all, i've different checkbox (class) inside a panel. Since i add them by code, i put them in a global list to avoid iOS release instance (i use tag for other things)
When i try this simple code, i get different error. In Simulator all works without issue, but on iphone 6s i have some problems

CODE
B4X:
If prog Then Return
        Dim v() As Object = Tag_
        Dim send As CheckBox = Sender

        If checked Then
            SelectedList.Add(send.Tag)
            SelectedText.Add(send.Text)
        Else
            SelectedList.RemoveAt(SelectedList.IndexOf(send.Tag))
            SelectedText.RemoveAt(SelectedText.IndexOf(send.Text))
        End If
  
        If Not(SelectedList.Size < v(0)) Then
            For Each vv As CheckBox In ListTemp
                If Not(vv.Checked) Then vv.Enabled = False
            Next
        Else
            For Each vv As CheckBox In ListTemp
                vv.Enabled = False
            Next
        End If

This happens if i put code inside a try catch
B4X:
[<UIButton 0x109e811b0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key bi.
Stack Trace: (
  CoreFoundation       <redacted> + 148
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  Foundation           <redacted> + 248
  Foundation           <redacted> + 264
  Tactivision          -[B4IShell getField] + 176
  Tactivision          -[B4IShell raiseEventImpl:method:args::] + 1712
  Tactivision          -[B4IShellBI raiseEvent:event:params:] + 1408
  Tactivision          -[B4ICommon CallSub4::::] + 344
  Tactivision          -[B4ICommon CallSub2::::] + 360
Tactivision          -[b4i_checkbox _sw_valuechanged::] + 1808
CoreFoundation       <redacted> + 144
CoreFoundation       <redacted> + 292
Tactivision          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
Tactivision          -[B4IShell runMethod:] + 448
Tactivision          -[B4IShell raiseEventImpl:method:args::] + 1784
Tactivision          -[B4IShellBI raiseEvent:event:params:] + 1408
Tactivision          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
libdispatch.dylib    <redacted> + 24
libdispatch.dylib    <redacted> + 16
libdispatch.dylib    _dispatch_main_queue_callback_4CF + 996
CoreFoundation       <redacted> + 12
CoreFoundation       <redacted> + 1572
CoreFoundation       CFRunLoopRunSpecific + 424
GraphicsServices     GSEventRunModal + 100
UIKit                UIApplicationMain + 208
Tactivision          main + 124
libdyld.dylib        <redacted> + 4
)

This happens without try/catch
B4X:
Error occurred on line: 245 (Dialogs)
-[UIButton _setenabled::]: unrecognized selector sent to instance 0x127dab990
Stack Trace: (
  CoreFoundation       <redacted> + 148
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  CoreFoundation       <redacted> + 916
  CoreFoundation       _CF_forwarding_prep_0 + 92
  Tactivision          -[b4i_dialogs _checkbox_checkedchange::] + 3652
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  Tactivision          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
  Tactivision          -[B4IShell runMethod:] + 448
Tactivision          -[B4IShell raiseEventImpl:method:args::] + 1784
Tactivision          -[B4IShellBI raiseEvent:event:params:] + 1408
Tactivision          -[B4ICommon CallSub4::::] + 344
Tactivision          -[B4ICommon CallSub2::::] + 360
Tactivision          -[b4i_checkbox _sw_valuechanged::] + 1808
CoreFoundation       <redacted> + 144
CoreFoundation       <redacted> + 292
Tactivision          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
Tactivision          -[B4IShell runMethod:] + 448
Tactivision          -[B4IShell raiseEventImpl:method:args::] + 1784
Tactivision          -[B4IShellBI raiseEvent:event:params:] + 1408
Tactivision          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
libdispatch.dylib    <redacted> + 24
libdispatch.dylib    <redacted> + 16
libdispatch.dylib    _dispatch_main_queue_callback_4CF + 996
CoreFoundation       <redacted> + 12
CoreFoundation       <redacted> + 1572
CoreFoundation       CFRunLoopRunSpecific + 424
GraphicsServices     GSEventRunModal + 100
UIKit                UIApplicationMain + 208
Tactivision          main + 124
libdyld.dylib        <redacted> + 4
)

Thanks to all!
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
What is the output of:
B4X:
For Each o As Object In ListTemp
Log(GetType(o))
Next
Thanks @Erel, with your code i see that i added also a button into the list. But i don't understand why in simulator works, and on real device no. By the way, i solved the issue
 
Upvote 0
Top