佚名通过本文主要向大家介绍了iosapp开发,iosapp设计规范,iosapp制作,iosapp退款,外包iosapp价格等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: iOS APP后台运行收到推送 语音播报无效 急急急!!!
描述:
解决方案1:
描述:
/* 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];
}
解决方案1:
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
请在你的info.plist里加上这项,需要设置后才能后台播放声音