iOS Question ActivityViewController & B4XPages

fbritop

Active Member
Licensed User
Longtime User
In classic B4I I used to share content:
B4X:
Dim avc As ActivityViewController
avc.Initialize("avc", Array(xc.translate("INVITATIONS.SHARE2") & CRLF & CRLF & groupCode))
avc.Show(pageConfigInvitations, pageConfigInvitations.RootPanel)

Now in B4XPages it was trying:
B4X:
Dim mp As Page = B4XPages.GetNativeParent(B4XPages.GetManager.GetTopPage)
Dim avc As ActivityViewController
avc.Initialize("avc", Array(xc.translate("INVITATIONS.SHARE2") & CRLF & CRLF & groupCode)
avc.Show(mp, mp.RootPanel)

But it crashes with Signal -11. Not sure if it is the correct way to reference the Native Page

B4X:
SignalHandler 11
Error occurred on line: 309 (B4XPagesManager)
Signal - 11
Stack Trace: (
    "0   LlaveMovil.com       SignalHandler + 120",
    "1   libsystem_platform.dylib            0x00000001903b29ec <redacted> + 40",
    "2   LlaveMovil.com       -[b4i_b4xpages _getnativeparent:] + 516",
    "3   CoreFoundation       <redacted> + 144",
    "4   CoreFoundation       <redacted> + 292",
    "5   LlaveMovil.com       +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608",
    "6   LlaveMovil.com       -[B4IShell runMethod:] + 448",
    "7   LlaveMovil.com       -[B4IShell raiseEventImpl:method:args::] + 2172",
    "8   LlaveMovil.com       -[B4IShellBI raiseEvent:event:params:] + 1580",
    "9   LlaveMovil.com       +[B4IDebug delegate:::] + 80"
)

I know that will work with:
Dim mp As Page = B4XPages.GetNativeParent(Me)

But as this is a function in a Code Module that is called from many parts, I was trying to avoid passing the "ME" object everytime on the function call.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…