• 通知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");

        }

  • 相关阅读:
    三维几何模板
    凸包
    计算几何 部分模板
    几何模板
    高斯消元模板
    tarjin求割点
    在无向图中找最短桥(tarjan)
    线段树
    错排问题
    NABCD分析
  • 原文地址:https://www.cnblogs.com/ldc529/p/4059769.html
Copyright © 2020-2023  润新知