iOS Question Create Empty Map

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi everybody, i have this strange error when i try to create an empty map.
B4X:
    MapOBJ.Initialize
    MapOBJ.Put("set",0) 'Set scelto
    MapOBJ.Put("talent",0) 'Talento scelto, in caso il set è alta gamma
    MapOBJ.Put("armor",CreateMap("base":0,"plus":0)) 'Armatura
    MapOBJ.Put("sel",3) 'Armi da fuoco, vigore, o elettronica
    MapOBJ.Put("maj",Null) 'Mappa con i bonus maggiori
    MapOBJ.Put("min",Null) 'Mappa con i bonus Minori
   
   
    Dim m1,m2,m3 As Map
    m1 = CreateMap("sel":3,"val":Null,"add":Null) '<----- Error
    m2 = CreateMap("sel":3,"val":Null,"add":Null)
    m3 = CreateMap("sel":3,"val":Null,"add":Null)
    Dim m As Map = CreateMap("0":m1,"1":m2,"2":m3)
    MapOBJ.Put("mod",m)

Is strange because it happens sometimes... i really don't understand what is the issue. Thanks for any help

B4X:
Application_Start
Device locale: en
Found 683 strings.
loc en
Found 682 strings.
loc IT
Application_Active
Class (b4i_richstring) instance released.
13
NSScanner: nil string argument
13
Sono entrato qui3
Error occurred on line: 67 (AddGears)
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[3]
Stack Trace: (
  CoreFoundation       __exceptionPreprocess + 189
  libobjc.A.dylib      objc_exception_throw + 49
  CoreFoundation       -[__NSPlaceholderArray initWithObjects:count:] + 279
  CoreFoundation       +[NSArray arrayWithObjects:count:] + 55
  Tactivision          -[b4i_addgears _initialize::] + 4762
  CoreFoundation       __invoking___ + 29
  CoreFoundation       -[NSInvocation invoke] + 321
  Tactivision          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1842
  Tactivision          -[B4IShell runMethod:] + 525
  Tactivision          -[B4IShell raiseEventImpl:method:args::] + 1881
Tactivision          -[B4IShellBI raiseEvent:event:params:] + 1915
Tactivision          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 67
libdispatch.dylib    _dispatch_call_block_and_release + 15
libdispatch.dylib    _dispatch_client_callout + 14
libdispatch.dylib    _dispatch_main_queue_callback_4CF + 1053
CoreFoundation       __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
CoreFoundation       __CFRunLoopRun + 2445
CoreFoundation       CFRunLoopRunSpecific + 372
CoreFoundation       CFRunLoopRunInMode + 123
GraphicsServices     GSEventRunModal + 71
GraphicsServices     GSEventRun + 80
UIKit                UIApplicationMain + 148
Tactivision          main + 140
libdyld.dylib        start + 1
)
 
Top