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
    }
  • 相关阅读:
    刷题[CISCN2019 华东南赛区]Web4
    刷题[GWCTF 2019]你的名字
    刷题[b01lers2020]Life on Mars
    刷题[SUCTF 2018]GetShell
    洛谷入门2-分支结构
    洛谷入门3-循环结构:回文质数、斐波那契数列
    洛谷入门3-循环结构:金币、最长连号
    洛谷入门3-循环结构:津津的储蓄计划
    C++类成员初始化方法
    英语听力
  • 原文地址:https://www.cnblogs.com/wsn1993/p/5158638.html
Copyright © 2011-2022 走看看