Heim > Fragen und Antworten > Hauptteil
/* 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];
}