iOS推送小结
(吐槽,md的代码编辑功能不知道是不会用还是确实不好用)
1.推送配置
1.1证书配置
请自行谷百.
1.2注册推送
//代码来源:环信Demo
//In method application:(UIApplication *)application didFinishLaunchingWithOptions:
UIApplication *application = [UIApplication sharedApplication];
//注册APNS
if([application respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType notificationTypes = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil];
[application registerUserNotificationSettings:settings];
}
#if !TARGET_IPHONE_SIMULATOR
if ([application respondsToSelector:@selector(registerForRemoteNotifications)]) {
[application registerForRemoteNotifications];
}else{
UIRemoteNotificationType notificati