zoukankan      html  css  js  c++  java
  • iOS8测试本地推送遇到问题

    xcoce 老报这个错

    {fire date = Friday, February 6, 2015 at 5:42:00 PM China Standard Time, time zone = (null), repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Friday, February 6, 2015 at 5:42:00 PM China Standard Time, user info = (null)} with an alert but haven’t received permission from the user to display alerts

    分析原因:

    是api有变

      

    /*
    报错信息可能如下:
    1 Attempting to schedule a local notification
    2 with an alert but haven't received permission from the user to display alerts
    3 with a sound but haven't received permission from the user to play sounds
    */
    //ios8中,在APP启动后增加如下代码
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //设置window
      //ios8  注册本地通知
      if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings *noteSetting =[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound
                                               categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:noteSetting];
      }
    }
  • 相关阅读:
    win10下 Ubuntu 18.04 LTS 的安装及 rlt8821ce网卡驱动的安装
    网络:tcp/ip
    数据结构分类
    面向对象的solid原则
    mysql数据库的操作
    锁机制
    设计模式在项目中的应用
    aop动态代理底层实现模拟
    变量在内存的分配_复习
    java内部类及类加载顺序
  • 原文地址:https://www.cnblogs.com/BinZone/p/4457201.html
Copyright © 2011-2022 走看看