SBRemoteNotificationServer

From iPhone Development Wiki
Revision as of 07:30, 31 May 2015 by PoomSmart (talk | contribs) (Faking push notification: Updated for iOS 8.)
Jump to: navigation, search

SBRemoteNotificationServer is a singleton class that receives Apple push notifications.

Faking push notification

Push notification may be faked locally these ways:

NSDictionary *userInfo = @{ @"aps" : @{ @"badge" = @5, @"alert" : @"hi" } };
NSString *topic = @"com.yourcompany.appname";

// pre iOS 8
[[%c(SBRemoteNotificationServer) sharedInstance] connection:nil didReceiveMessageForTopic:topic userInfo:userInfo];

// iOS 8
APSIncomingMessage *message = [[%c(APSIncomingMessage) alloc] initWithTopic:topic userInfo:userInfo];
[[%c(SBRemoteNotificationServer) sharedInstance] connection:nil didReceiveIncomingMessage:message];
[message release];

References