下载极光推送文件,将以下两个文件导入项目中

APService.h

libpushSDK.a

#import "HMAppDelegate.h"
#import "APService.h" @implementation HMAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Required
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
// Required
[APService setupWithOption:launchOptions]; return YES;
} - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Required(上传DeviceToken给极光推送的服务器)
[APService registerDeviceToken:deviceToken];
} - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { // Required
[APService handleRemoteNotification:userInfo];
} - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { // IOS 7 Support Required
[APService handleRemoteNotification:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
@end
05-06 02:36