iOS容联-云通讯 离线消息接收实现 推送

释放双眼,带上耳机,听听看~!

1 第一步

需要在控制台里面上传证书 这是链接 http://www.yuntongxun.com/doc/sdk/sdkabout/2_1_1_2.html

2 第二步

将工程中的推送开关开启

 

 

3 第三步

请求token

  //iOS8 注册APNS

    if ([application respondsToSelector:@selector(registerForRemoteNotifications)]) {

        UIUserNotificationType notificationTypes = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil];

        [application registerUserNotificationSettings:settings];

    } else {

        UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeBadge |

        UIRemoteNotificationTypeSound |

        UIRemoteNotificationTypeAlert;

        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];

    }

 

 

4 第四步

将得到的deviceToken传给SDK

 

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken

{

    [[ECDevice sharedInstance]application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];

}

 

 

 

这四步 缺一不可 操作完成之后打包测试就ok啦

 

 

人已赞赏
iOS文章

iOS bugly集成报错

2020-5-1 15:16:50

iOS文章

iOS 渐变颜色

2020-5-1 16:31:49

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索