iOS Question [solved] B4XPages - B4XPage_Appear crash

AymanA

Active Member
Licensed User
Hi All,

I am trying to set the text for B4XFloatTextField in B4XPage_Appear but it crashes with the stack in the code block below.

I understand that when a page appear the events that will raise is B4XPage_Created then B4XPage_Appear, so I am tryin to use B4XPage_Appear since my data is coming from jRDC2, so I want to view the updated output on CLV, whenever I move from B4XMainPage to any other pages.

I have attached an example for my problem.

1- press on the button.
2 - press back key.
3- press button again - it will crash with the stack below

Error Stack:
Application_Start
Application_Active
Page with this id already exists: first!
Error occurred on line: 276 (B4XFloatTextField)
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]
Stack Trace: (
  CoreFoundation       __exceptionPreprocess + 242
  libobjc.A.dylib      objc_exception_throw + 48
  CoreFoundation       _CFThrowFormattedException + 194
  CoreFoundation       -[__NSPlaceholderArray initWithCapacity:].cold.1 + 0
  CoreFoundation       -[__NSPlaceholderArray initWithObjects:count:] + 154
  CoreFoundation       +[NSArray arrayWithObjects:count:] + 40
  B4i Example          -[b4i_b4xfloattextfield _tf_textchanged:::] + 797
  B4i Example          -[b4i_b4xfloattextfield _settext::] + 668
  B4i Example          -[b4i_test2 _b4xpage_appear:] + 372
  CoreFoundation       __invoking___ + 140
CoreFoundation       -[NSInvocation invoke] + 303
B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1669
B4i Example          -[B4IShell runMethod:] + 401
B4i Example          -[B4IShell raiseEventImpl:method:args::] + 2361
B4i Example          -[B4IShellBI raiseEvent:event:params:] + 1357
B4i Example          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 51
libdispatch.dylib    _dispatch_call_block_and_release + 12
libdispatch.dylib    _dispatch_client_callout + 8
libdispatch.dylib    _dispatch_main_queue_callback_4CF + 1045
CoreFoundation       __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
CoreFoundation       __CFRunLoopRun + 2685
CoreFoundation       CFRunLoopRunSpecific + 567
GraphicsServices     GSEventRunModal + 139
UIKitCore            -[UIApplication _run] + 912
UIKitCore            UIApplicationMain + 101
B4i Example          main + 112
libdyld.dylib        start + 1
???                  0x0 + 1
)
 

Attachments

  • Project.zip
    176.6 KB · Views: 208

AymanA

Active Member
Licensed User
I am not sure how to thank you for your help! this has definitely solved the problem for me! - I am still trying to learn and grasp the concept for B4XPages, so hopefully I will be there soon :D
 
Upvote 0
Top