To run the example project, clone the repo, and run pod install
from the Example directory first.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[ARNPush setDeviceTokenBlock:^(NSString *deviceToken, NSError *error) {
if (error) {
// didFailToRegisterForRemoteNotificationsWithError
} else {
// didRegisterForRemoteNotificationsWithDeviceToken
}
}];
[ARNPush setAlertBlock:^(NSDictionary *userInfo) {
NSLog(@"Call ARNPush Alert Block");
}];
[ARNPush setSoundBlock:^(NSDictionary *userInfo) {
NSLog(@"Call ARNPush Sound Block");
}];
[ARNPush setBadgeBlock:^(NSDictionary *userInfo) {
NSLog(@"Call ARNPush Badge Block");
}];
[ARNPush registerForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
launchOptions:launchOptions];
return YES;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
// call ARNPush DeviceTokenBlock
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
// call ARNPush DeviceTokenBlock
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
// call ARNPush AlertBlock, SoundBlock, BadgeBlock
}
- iOS 7.0+
- ARC
ARNPush is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ARNPush"
replaced the following methods.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
// iOS 8.0+ Only
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler;
ARNPush is available under the MIT license. See the LICENSE file for more info.