zoukankan      html  css  js  c++  java
  • APNs

    生成推送证书:

    1. 登陆开发者中心:https://developer.apple.com
    2. 点开 certificates、identifiers 和 proversionprofiles 里面
    3. 创建 APPID, 勾选 push notification servers 服务
    4. 搜索刚才创建的 APPID,点击 edit,配置证书, 下载双击。
    5. 证书创建完成, 钥匙链内右键导出 p12

    实现的代码在 AppDelegate.h

    #import "AppDelegate.h"
    
    @interface AppDelegate ()
    
    @end
    
    @implementation AppDelegate
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        
        //请求通知权限
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert |UIUserNotificationTypeSound | UIUserNotificationTypeBadge categories:nil];
        [application registerUserNotificationSettings:settings];
        
        //注册远程通知
        [application registerForRemoteNotifications];
        return YES;
        
    }
    //deviceToken, 设备令牌, 唯一.
    
    //远程推送注册成功
    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        NSLog(@"%@", deviceToken);
        //post 请求发给自己的服务器
        
        //生成推送证书:
        //1. 登陆开发者中心:https://developer.apple.com
        //2. 点开 certificates、identifiers 和 proversionprofiles 里面
        //3. 创建 APPID, 勾选 push notification servers 服务
        //4. 搜索刚才创建的 APPID,点击 edit,配置证书, 下载双击。
        //5. 证书创建完成, 钥匙链内右键导出 p12
    }
  • 相关阅读:
    初识HTML
    django中这是登录过期时间
    linux之几个重要性能指标
    linux之查看端口占用
    python目录操作整理
    jmeter用户自定义变量的实际使用
    ubuntu安装mysql与配置外网访问
    ubuntu 16.04部署python项目(Nginx+uwsgi+django)
    selenium脚本奇怪报错
    在Ubuntu云服务上部署jenkins
  • 原文地址:https://www.cnblogs.com/wsn1993/p/5158638.html
Copyright © 2011-2022 走看看