Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4838] iOS: push notification callbacks invoked twice

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNeeds more info
Resolution Date2011-08-01T12:28:59.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sSprint 2011-31
ComponentsiOS
Labelscallback, ios, look1, notifications, push
ReporterEduardo Gomez
AssigneeBlain Hamon
Created2011-07-29T13:44:36.000+0000
Updated2017-03-16T20:44:07.000+0000

Description

Problem

When the app is running and a push message is sent, the callback is called and the message is displayed. But when the app has been closed and a push message was sent, iOS displays an alert with the message, and then when the app is opened by clicking 'View' from the alert, the callback is called which displays a second alert with the same message. According to a development comment, that method shouldn't be called if the app is started by a Notification.

Core source code

#pragma mark Push Notification Delegates

#ifdef USE_TI_NETWORKREGISTERFORPUSHNOTIFICATIONS

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
	// NOTE: this is called when the app is *running* after receiving a push notification
	// otherwise, if the app is started from a push notification, this method will not be 
	// called
	RELEASE_TO_NIL(remoteNotification);
	[self generateNotification:userInfo];
	
	if (remoteNotificationDelegate!=nil)
	{
		[remoteNotificationDelegate performSelector:@selector(application:didReceiveRemoteNotification:) withObject:application withObject:remoteNotification];
	}
}

Associated HD ticket

As an ENT customer relies on this, I set Customer priority to Immediate. http://appc.me/c/APP-919486

Additional info

The message is being sent to the device using Urban Airship. Let me know please if anymore data is needed.

Comments

  1. Blain Hamon 2011-08-01

    Will need a sample app/source that shows what the app does with the payload once they receive it. I have a sneaking suspicion that the JS code presents a dialog from notification. If this is the case, then the bug is invalid: If an application is running when the notification comes in, it should NOT present a dialog -- the user is already in the application -- but should update the information in the background with the payload. Similarly, when launched from an alert, the payload can be used to direct the application onto where to focus. For example, in an SMS app, if you receive an SMS, you do NOT get a dialog alerting you. Instead, the list of conversations is updated. When not in an SMS app and a notification happens, the OS provides an alert as an offering to view the SMS in detail. If the user so takes the offer, the payload is passed onto the app in order for the app to update the focus.
  2. Lee Morris 2017-03-16

    Closing ticket as the information that was requested was never provided.

JSON Source