目前市面上很多聚合支付APP都需要在收款成功后,进行语音提示,例如收钱吧,乐惠等!公司App融E收也同样需要实现改功能,主要分为2个部分,一是推送,而是语音播报,下面简单介绍一下
一 推送,目前集成的推送主要是极光推送,集成极光推动的流程比较简单,主要流程是
1.注册账号,在极光推送官网上注册账号,地址:https://www.jiguang.cn/accounts/register/form
2.登录账号,右上角点击创建应用,填写应用名称,上传应用icon,点击创建
3.上传推送证书,做APNS验证
4.导入极光推送SDK, pod 'JPush'
5.在AppDelegete里面导入
做完上面的工作基本已经可以在代码中集成推送了
代码:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25//集成推送,注册 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [JPUSHService registerForRemoteNotificationConfig:entity delegate:self]; [JPUSHService setupWithOption:launchOptions appKey:@"You appKey" channel:nil apsForProduction:YES]; //获取registrationID [JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) { }]; } #pragma mark - 推送代理方法 //ios10以前调用 --- 前后台收到消息 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { //接收到消息 } // iOS 10 --- 前台显示推送 - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler { //接收到消息 } // iOS 10 --- 后台显示推送 - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler { //接收到消息 } // 获取设备deviceToken - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ [JPUSHService registerDeviceToken:deviceToken]; }
最后
以上就是聪明书包最近收集整理的关于iOS - 根据推送消息进行语音播报的全部内容,更多相关iOS内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复