iOS Question B4XPages - GetNativeParent(Me) is crashing

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,
on B4A this code works, but on B4I i get this error:
B4X:
Copying updated assets files (2)
Application_Start
Application_Active
Error occurred on line: 276 (B4XPagesManager)
Expected: UIView, object type: B4IViewController
Stack Trace: (
  CoreFoundation       __exceptionPreprocess + 350
  libobjc.A.dylib      objc_exception_throw + 48
  CoreFoundation       +[NSException raise:format:] + 188
  B4i Example          -[B4IObjectWrapper setObject:] + 258
  B4i Example          -[B4XViewWrapper setObject:] + 144
  B4i Example          +[B4IObjectWrapper createWrapper:object:] + 99
  B4i Example          -[b4i_b4xpage2 _b4xpage_created::] + 1011
  CoreFoundation       __invoking___ + 140
  CoreFoundation       -[NSInvocation invoke] + 321
  B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1669
B4i Example          -[B4ICommon CallSubDebug4::::] + 1063
B4i Example          -[B4ICommon CallSubDebug2::::] + 326
B4i Example          -[b4i_b4xpagesmanager _createpageifneeded::] + 1071
B4i Example          -[b4i_b4xpagesmanager _showpageandremovepreviouspages::] + 809
B4i Example          -[b4i_b4xpages _showpageandremovepreviouspages:] + 474
B4i Example          -[b4i_b4xmainpage _btnlogin_click:] + 346
CoreFoundation       __invoking___ + 140
CoreFoundation       -[NSInvocation invoke] + 321
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 + 1042
CoreFoundation       __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
CoreFoundation       __CFRunLoopRun + 2041
CoreFoundation       CFRunLoopRunSpecific + 404
GraphicsServices     GSEventRunModal + 139
UIKitCore            UIApplicationMain + 1605
B4i Example          main + 112
libdyld.dylib        start + 1
???                  0x0 + 1
)
B4X:
Private toast As BCToast
toast.Initialize(B4XPages.GetNativeParent(Me))

In the attachment is a example project, on B4XPage2 i Initialize the toast.

The code is from this thread:
 

Attachments

  • ThreePagesExample.zip
    223.7 KB · Views: 167
Top