• ios8推送新增


    ios8新增了catory字段 这个字段的标示符identifier必须和后台字段一致。

    catory是

    UIMutableUserNotificationCategory这个类 初始化的方法如下

        UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategoryalloc] init];

        categorys.identifier = @"categoryIdentifier";

        [categorys setActions:@[action,action2]forContext:(UIUserNotificationActionContextMinimal)];

    相当于创建了一个按钮集合

    代码中的action 即UIMutableUserNotificationAction

    UIMutableUserNotificationAction *action = [[UIMutableUserNotificationActionalloc] init];

        action.identifier = @"action";

        action.title=@"Accept";

        action.activationMode = UIUserNotificationActivationModeForeground;


    activationMode查看可知是一个结构体 

    /*

     

    typedef NS_ENUM(NSUInteger, UIUserNotificationActivationMode) {

     

        UIUserNotificationActivationModeForeground, // activates the application in the foreground

     

        UIUserNotificationActivationModeBackground  // activates the application in the background, unless it's already in the foreground

     

    } NS_ENUM_AVAILABLE_IOS(8_0);

    */


    注册通知

     

     [application registerForRemoteNotificationTypes:(UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound) categories:[NSSetsetWithObjects:categorys, nil]];

    这样就可以在通知栏里看到这样的效果了如下


    IMG 0235


    文章学习来源于 http://blog.csdn.net/apple_app/article/details/39228221

  • 相关阅读:
    苏宁易购积分规则
    购物车的实现原理
    <mvc:annotation-driven />讲解
    c3p0、dbcp和proxool比较
    Spring的事务到底该给Dao配置还是给Service配置?
    Spring PropertyPlaceholderConfigurer占位符用法
    Spring <context:annotation-config />讲解
    DispatcherServlet讲解
    Spring3.1新特性
    Spring MVC入门
  • 原文地址:https://www.cnblogs.com/machealking/p/4665162.html
Copyright © 2020-2023  润新知