Post

Replies

Boosts

Views

Activity

Announce my apps' Notifications in CarPlay
My app uses UNMutableNotificationContent() to play a custom sound, and has a phrase as a message. I just got a vehicle with CarPlay. When my iPhone is connected to CarPlay, when the notification goes off at a time, it shows on the iPhone, but does not make any noise whatsoever. What I'd like to happen, is for CarPlay to announce the message when the notification goes off, like it does with Apple's messages app. As my phone is set right now, when I have my airPods in, it will announce the notification from my app. But not for CarPlay. What do I need to add to my app to allow CarPlay to announce the message that comes in from a notification (again, local, not a push notification).
0
0
548
Aug ’23
Problems after App Transfer
I have just created a new business developer account, and I have transferred all of my apps to it. That was easy. The app id's are all in my new account. If I create a new Xcode project, I can install it on the actual device with no issues. My problem is when I try to update one of my apps that i've downloaded from the App store. I get the message "Unable to install 'appName'". I've been googling for 24 hours, trying to look into this. I found a post that stated that this isn't an issue for users when I finally get around to sending an update to the AppStore. I have made a provisional profile for the app, and after temporarily shutting off "Automatic Code Signing" I installed it. That didn't work either. No errors, just the "Unable to install" message.(I've switched back to "Automatic Code Signing" since that wasn't the problem.) So how do I update my app using the new developer account?
3
1
1.1k
Nov ’22
Recording AVSpeechSynthesizer
I'm trying to record a phrase using AVSpeechSynthesizer.write. It appears to save "something", but when I try to play that back, nothing is played. Not sure where I'm going wrong (wrong file type, not actually saving a file, I don't have the play portion set correctly). Any help would be greatly appreciated. The "speakPhrase" function is just to prove that the AVSpeech is set up properly. That works just fine. import AVFoundation import Foundation class Coordinator {     let synthesizer: AVSpeechSynthesizer     var player: AVAudioPlayer?     init() {         let synthesizer = AVSpeechSynthesizer()         self.synthesizer = synthesizer     }     var recordingPath:  URL {         let soundName = "Finally.caf"         // I've tried numerous file extensions.  .caf was in an answer somewhere else.  I would think it would be         // .pcm, but that doesn't work either.         // Local Directory         let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)         return paths[0].appendingPathComponent(soundName)     }     func speakPhrase(phrase: String) {         let utterance = AVSpeechUtterance(string: phrase)         utterance.voice = AVSpeechSynthesisVoice(language: "en")         synthesizer.speak(utterance)     }     func playFile() {         print("Trying to play the file")         do {             try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)             try AVAudioSession.sharedInstance().setActive(true)                          player = try AVAudioPlayer(contentsOf: recordingPath, fileTypeHint: AVFileType.caf.rawValue)             guard let player = player else {return}                 player.play()         } catch {             print("Error playing file.")         }     }     func saveAVSpeechUtteranceToFile() {         let utterance = AVSpeechUtterance(string: "This is speech to record")         utterance.voice = AVSpeechSynthesisVoice(language: "en-US")         utterance.rate = 0.50         synthesizer.write(utterance) { [self] (buffer: AVAudioBuffer) in             guard let pcmBuffer = buffer as? AVAudioPCMBuffer else {                 fatalError("unknown buffer type: \(buffer)")             }             if pcmBuffer.frameLength == 0 {                 // Done             } else {                 // append buffer to file                 do {                     let audioFile = try AVAudioFile(forWriting: recordingPath, settings: pcmBuffer.format.settings, commonFormat: .pcmFormatInt16, interleaved: false)                     try audioFile.write(from: pcmBuffer)                 } catch {                     print(error.localizedDescription)                 }             }         }     } }
0
0
1k
Sep ’22
SwiftUI and Xcode 12 - Keyboard Notification
let nofiticationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(keyBoardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) Doesn't appear to work with Xcode 12 beta 1. Has something replaced UIResponder for keyboard notifications?
1
0
768
Jun ’20