zoukankan      html  css  js  c++  java
  • 通知Notification相关

    1.IOS8 注册远程通知

    if([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)

                {

                    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

                    [[UIApplication sharedApplication] registerForRemoteNotifications];

                }else{

                    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];

                }

    certificates中,apns 证书和普通证书的区别:

    apns证书:

    apns证书是用来生成p12与苹果apns服务器通信用的,

    在appid中开启apns后上传CertificateSigningRequest.certSigningRequest后就会在certificates中生成对应的apns证书,在certificates中删除,同样会在appid中删除该apns证书。

    并且该证书不会在provisioning profile中显示。

    普通证书:如在certificates中的IOS Developer

    在生成provisioning profile签名时可选择。 

    Provisioning Profile

    在xcode上运行程序到真机需要使用改签名。

    一个Provisioning Profile文件包含了上述的所有内容:证书、App ID、设备。

    2.检测用户是否允许通知,允许哪种类型的通知

      //ios7

      [UIApplication sharedApplication].enabledRemoteNotificationTypes

      // ios8以上

        UIUserNotificationSettings *setting = [UIApplication sharedApplication].currentUserNotificationSettings;

        if (setting.types == UIUserNotificationTypeNone ) {

            NSLog(@"UIUserNotificationTypeNone");

        }

        if (setting.types & UIUserNotificationTypeAlert ) {

            NSLog(@"UIUserNotificationTypeAlert");

        }

        if (setting.types & UIUserNotificationTypeSound ) {

            NSLog(@"UIUserNotificationTypeSound");

        }

        if (setting.types & UIUserNotificationTypeBadge ) {

            NSLog(@"UIUserNotificationTypeBadge");

        }

  • 相关阅读:
    加密算法
    oracle利用正则表达式判断字符串只包含数字
    LINUX下用数据泵导入导出(IMPDP、EXPDP)
    Oracle删除用户和表空间
    SQL脚本
    Oracle 查询库中所有表名、字段名、字段名说明,查询表的数据条数、表名、中文表名、
    Oracle修改表Table所属表空间及Clob、Blob字段的处理
    Linux下修改Oracle监听地址
    批量删除默认用户
    oracle创建新用户和用户表空间
  • 原文地址:https://www.cnblogs.com/ldc529/p/4059769.html
Copyright © 2011-2022 走看看