iOS Question Expected: NSArray, object type: B4IList

tzfpg

Active Member
Licensed User
B4J send to B4I but error show up.

B4J code
B4X:
Type returnresult(case_type As String,result As Object)

-------------------------------------------------------------------------
dim alist as list
alist.initialize
for i = 0 to 100
alist.add(i)
next

Dim ReturnResult As returnresult
                ReturnResult.Initialize
                ReturnResult.case_type="ReturnErrorData"
                ReturnResult.result=alist
                client.Publish(red.unique_id,Ser.ConvertObjectToBytes(LTSReturnResult))
B4I code
B4X:
Type returnresult(case_type As String,result As Object)
-------------------------------------------------------------------------
Dim data As Object=Ser.ConvertBytesToObject(Payload)
        Dim result As returnresult
        result.Initialize
        result=data

If result.case_type="ReturnErrorData" Then
            Dim alist As List
            alist=result.result <----error show at here
.......
end if
error code
B4X:
Error occurred on line: 317 (Main)
Expected: NSArray, object type: B4IList
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  LDM ST               -[B4IObjectWrapper setObject:] + 280
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  LDM ST               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
  LDM ST               -[B4IShell runVoidMethod] + 232
  LDM ST               -[B4IShell raiseEventImpl:method:args::] + 1800
  LDM ST               -[B4IShellBI raiseEvent:event:params:] + 1580
 LDM ST               +[B4IObjectWrapper raiseEvent:::] + 300
 LDM ST               -[MQTTClient handleMessage:onTopic:retained:] + 232
 LDM ST               -[MQTTSessionManager newMessage:data:onTopic:qos:retained:mid:] + 144
 LDM ST               -[MQTTSession handlePublish:] + 996
 LDM ST               -[MQTTSession decoder:newMessage:] + 2204
 LDM ST               -[MQTTDecoder stream:handleEvent:] + 2260
 CoreFoundation       <redacted> + 216
 CoreFoundation       <redacted> + 372
 CoreFoundation       <redacted> + 24
 CoreFoundation       <redacted> + 88
 CoreFoundation       <redacted> + 176
 CoreFoundation       <redacted> + 1004
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 104
 UIKitCore            UIApplicationMain + 212
 LDM ST               main + 124
 libdyld.dylib        <redacted> + 4
)
how can solve this problem?
 
Top