zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    蓝桥杯训练 | 二分和前缀和 | 02
    广西师大数据结构 | 2015年真题 | 02
    广西师大数据结构 | 2014年真题 | 01
    Centos添加开机自启项
    SUSE系统添加开机自启项
    LNMP
    源码编译安装 libiconv-1.14(php依赖)
    lnmp
    centos添加epel源
    系统挂在镜像
  • 原文地址:https://www.cnblogs.com/machealking/p/4665162.html
Copyright © 2011-2022 走看看