Sub Process_Globals
...
Dim myMsg as NativeObject
End Sub
' Here we show the message, as a part of our app
Sub showMessage
myMsg = msgBox2(msg, "Dadada", "Dododo", Array("OK") )
Wait For msg_Click (ButtonText As String)
If ButtonText = "OK" Then
...
End If
End Sub
' This is what we must call when we resume the app, in order to "kill" pending messageBoxes
Sub dismissMessageBoxIfAny
If myMsg.isInitialized Then
Dim nno As NativeObject = Me
nno.RunMethod("dismiss:",Array(myMsg.getField("_alertController")))
' Not sure how to achieve the same directly. Tried this but crashed...
' myMsg.getField("_alertController").RunMethod("dismissViewControllerAnimated::",Array(True,Null))
End if
End Sub
#If OBJC
- (void)dismiss: (UIAlertController*) mAlert {
[mAlert dismissViewControllerAnimated:YES completion:nil];
}
#end if