SBRemoteNotificationServer

From iPhone Development Wiki
Revision as of 11:48, 28 October 2009 by KennyTM~ (talk | contribs) (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…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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