찾다

 >  Q&A  >  본문

objective-c - iOS APP后台运行收到推送 语音播报无效 急急急!!!

/* 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];
}
迷茫迷茫2767일 전479

모든 응답(0)나는 대답할 것이다

답장 없음
  • 취소회신하다