objective-c - iOS APP后台运行收到推送 语音播报无效 急急急!!!
迷茫
迷茫 2017-04-18 09:57:31
0
0
476
/* APP已经接收到“远程”通知(推送) - 透传推送消息  */

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
    // 处理APNs代码,通过userInfo可以取到推送的信息(包括内容,角标,自定义参数等)。如果需要弹窗等其他操作,则需要自行编码。
    NSLog(@"\n>>>[Receive RemoteNotification - Background Fetch]:%@\n\n",userInfo);
    
    //静默推送收到消息后也需要将APNs信息传给个推统计
    [GeTuiSdk handleRemoteNotification:userInfo];
    
    completionHandler(UIBackgroundFetchResultNewData);
    av = [[AVSpeechSynthesizer alloc]init];
    av.delegate = self;
    AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:@"你有一条新订单"];
    utterance.rate=0.5;
    AVSpeechSynthesisVoice*voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];
    utterance.voice= voice;
    
    [av speakUtterance:utterance];
}
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!