iOS Question Trouble with launching MessageComposer

Haris Hafeez

Active Member
Licensed User
Longtime User
Hello Everyone,

I have run into a rather strange error, which I'm quite sure has to do with me missing something.

I am trying to launch the MessageComposer when the user clicks on a local notification. The errors I get in the log are:

Class (b4i_customlistview) instance released.
<CKSMSComposeRemoteViewController: 0x1475eea0> timed out waiting for fence barrier from
MC Result = 0
Warning: Attempt to dismiss from view controller <UINavigationController: 0x14549830> while a presentation or dismiss is in progress!

Any tips on how to resolve this please?

Many thanks.

Haris Hafeez

Active Member
Licensed User
Longtime User
Thanks for your reply. I managed to get the notification working by moving the code around a bit. However, the issue I now get is that the notification tag is always nil. Will appreciate help with this. The CustomListView was always a global, I wonder why its claiming to release it.

So the code is like this:
Private Sub Application_Active

    If IsLaunchedFromNotification Then
        If Not(ScheduledMessagesPage.Visible) Then 'bring this page to the top before attempting to set it as a parent of messagecomposer
        End If
        Log("Notification.Tag = " & LaunchingNotification.Tag) 'prints nil
    End If
End Sub

Sub Application_ReceiveLocalNotification (LN As Notification)
    'this event will fire if the scheduled notification happend when the app was running
    Log("launched while app is running. LN.TAG = " & LN.Tag) 'prints nil
    IsLaunchedFromNotification = True
    LaunchingNotification = LN
End Sub

Sub HandleTextNotificationLaunch(key As String)
    Dim mc As MessageComposer
    If mc.CanSendText Then
        Log("Before getting pending message. key: " & key) 'prints nil
        Dim pm As PendingMessage = MessageStore.GetSavedMessage(key) 'fails here
        Log("Composing text: " & pm.StrMessage & ", to: " & pm.StrTo)
        mc.SetRecipients(Array As String(pm.StrTo))
        'mc.SetRecipients(Array As String("Haris"))
        mc.Body = pm.StrMessage
        'mc.Body = "Test message body"
        Log("Can't send TEXTS :(")
    End If
End Sub

The code that sets the notification is:

Sub ScheduleLocalNotificationForMessage(key As String)
    Dim n As Notification
    Dim pm As PendingMessage = MessageStore.GetSavedMessage(key)
    DateTime.TimeFormat = "HH:mm"
    Dim ticks As Long = DateTime.DateTimeParse(pm.Date,pm.Time)
    n.AlertBody = "Would you like to send the scheduled message to " & pm.StrTo &"?"
    n.Tag = key
    n.PlaySound = True
End Sub
Upvote 0

Haris Hafeez

Active Member
Licensed User
Longtime User
The Tag will be empty. The tag information is not added to the notification object that the system creates.
So how do we determine what action to take based on a notification? It seems that I will have encode some information in the notification itself.

Upvote 0