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

  • 相关阅读:
    MySQL Sandbox安装使用
    主从复制延时判断
    Carthage
    QCon 2015 阅读笔记
    QCon 2015 阅读笔记
    Scrum&Kanban在移动开发团队的实践 (一)
    移动开发-第三方聊天服务
    开通博客
    spark的若干问题
    hadoop2.2.0安装需要注意的事情
  • 原文地址:https://www.cnblogs.com/machealking/p/4665162.html
Copyright © 2011-2022 走看看