Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
SBRemoteNotificationServer: Difference between revisions - iPhone Development Wiki

SBRemoteNotificationServer: Difference between revisions

From iPhone Development Wiki
m (Created page with 'SBRemoteNotificationServer is a singleton class that receives Apple push notifications. == Faking push notification == Push notification may be faked locally using the -conn…')
(No difference)

Revision as of 11:48, 28 October 2009

SBRemoteNotificationServer is a singleton class that receives Apple push notifications.

Faking push notification

Push notification may be faked locally using the -connection:didReceiveMessageForTopic:userInfo: method, like this:

static const char plist[] = "{aps={badge=5;alert=hi;};etc=foo;}";
NSDictionary* userInfo = [NSPropertyListSerialization propertyListFromData:[NSData dataWithBytesNoCopy:plist length:sizeof(plist) freeWhenDone:NO]
                                                          mutabilityOption:NSPropertyListImmutable format:NULL errorDescription:NULL];
[[SBRemoteNotificationServer sharedInstance] connection:nil didReceiveMessageForTopic:@"com.yourcompany.appname" userInfo:userInfo];

References