• 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

  • 相关阅读:
    算法之冒泡排序(Java语言)
    算法之水仙花数(Java语言)
    md5加密解析
    Java项目中环境变量的问题
    外行码农进阶学习指导思想
    初识TCP
    const修饰符总结
    网格计算的三种体系结构概述
    虚函数的实现
    网络计算概述
  • 原文地址:https://www.cnblogs.com/machealking/p/4665162.html
Copyright © 2020-2023  润新知