SBRemoteNotificationServer

From iPhone Development Wiki

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

Personal tools