Created
May 31, 2015 07:27
-
-
Save PoomSmart/8f7bf2eb92e8ebd44185 to your computer and use it in GitHub Desktop.
Fake Push Notifications for iOS 7+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
// ApplePushService.framework | |
@interface APSMessage : NSObject | |
- (id)initWithTopic:(NSString *)topic userInfo:(NSDictionary *)userInfo; | |
@end | |
@interface APSIncomingMessage : APSMessage | |
@end | |
@interface SBRemoteNotificationServer : NSObject | |
+ (SBRemoteNotificationServer *)sharedInstance; | |
- (void)connection:(id /* APSConnection* */)connection didReceiveIncomingMessage:(APSIncomingMessage *)message; | |
@end | |
static void notifyUserWithMessageAndBundleIdentifier(NSString *message, NSString *bundleIdentifier) | |
{ | |
NSDictionary *userInfo = @{ @"aps" : @{ @"alert" : message } }; | |
// if an application returned by bundleIdentifier does not exist, the system will not push. | |
// nil userInfo causes system to crash. | |
APSIncomingMessage *message = [[%c(APSIncomingMessage) alloc] initWithTopic:bundleIdentifier userInfo:userInfo]; | |
[[%c(SBRemoteNotificationServer) sharedInstance] connection:nil didReceiveIncomingMessage:message]; | |
[message release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment