Xcode updated yesterday, and am now at
Xcode Version 13.3 (13E113)
Since then, whenever I debug my app the the simulator, I get the message below. Am curious if I should be concerned.
If it makes a difference: Yes, I have an IBM keyboard attached via USB.
Also this does not happen when I debug the app on the iPhone itself.
2022-03-15 14:50:45.745237-0400 Hello World[48883:648134] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I just upgraded to Xcode 12.4, created a project using the "app" template, without SwiftUI, I chose Storyboard instead.
I placed a small image on the LaunchScreen.storyboard, and an NSLog output in my ViewController.
When I run the app on the simulator, the LaunchScreen does not, show, and I do get my NSLog output. So I know the app is running. When run this bare app on my physical iPhone X...I do get the launch screen.
So I opened a game app I started under Xcode 11.x. It will show the LaunchScreen on both simulator and my device.
I've checked that Launch screen interface file base name is set to LaunchScreen in Info.plist. It's also set under App Icons and Launch Images.
Is this some bug?
I am trying to save the buffer from my installTap to a file. I do it in chunks of 10 so I'll get a bigger file. When I try to play the written file (from the simulator's directory) QuickTime says that it's not compatible.
I have examined the bad m4a file and a working one. There are a lot of zero's in the bad file at the beginning followed by a lot of data. However both files appears to have the same header.
A lot of people mention that I have to nil the AudioFile, but:
audioFile = nil
is not a valid syntax, nor can I file a close method in AudioFile.
Here's the complete code, edited into one working file:
import UIKit
import AVFoundation
class ViewController: UIViewController {
let audioEngine = AVAudioEngine()
var audioFile = AVAudioFile()
var x = 0
override func viewDidLoad() {
super.viewDidLoad()
record()
// Do any additional setup after loading the view.
}
func makeFile(format: AVAudioFormat) {
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
do {
_ = try FileManager.default.contentsOfDirectory(at: paths!, includingPropertiesForKeys: nil)
} catch { print ("error")}
let destinationPath = paths!.appendingPathComponent("audioT.m4a")
print ("\(destinationPath)")
do {
audioFile = try AVAudioFile(forWriting: destinationPath,
settings: format.settings)
print ("file created")
} catch { print ("error creating file")}
}
func record(){
let node = audioEngine.inputNode
let recordingFormat = node.inputFormat(forBus: 0)
makeFile(format: recordingFormat)
node.installTap(onBus: 0, bufferSize: 8192, format: recordingFormat, block: { [self]
(buffer, _) in
do {
try audioFile.write(from: buffer);
print ("buffer filled");
x += 1;
print("wrote \(x)")
if x > 9 {
endThis()
}
} catch {return};})
audioEngine.prepare()
do {
try audioEngine.start()
} catch let error {
print ("oh catch")
}
}
func endThis(){
audioEngine.stop()
audioEngine.inputNode.removeTap(onBus: 0)
}
}
I have my mainController (parent) and my menuController (child).
I call the menuController with
addChild(child)
view.addSubview(child.view)
child.didMove(toParent: self)
The child dismisses itself with:
self.dismiss(animated: true, completion: nil)
The question I have, is how do I clean up the child within the parent? Surely I have to do something?
Building a very simple voice-to-text app, which I got from an online demo.
What I can't seem to find is how to reset the response back to nil. This demo just keeps transcribing from the very beginning till it finally stalls.
While I don't know how if the stall is related to my question, I still need to find out how to code "Ok, got the first 100 words. Reset response text to nil. Continue."
func startSpeechRecognition(){
let node = audioEngine.inputNode
let recordingFormat = node.outputFormat(forBus: 0)
node.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat, block: { (buffer, _) in self.request.append(buffer)})
audioEngine.prepare()
do {
try audioEngine.start()
} catch let error {
alertView(message: "audioEngine start error")
}
guard let myRecognition = SFSpeechRecognizer() else {
self.alertView(message: "Recognition is not on your phone")
return
}
if !myRecognition.isAvailable {
self.alertView(message: "recognition is not available right now")
}
task = speechRecognizer?.recognitionTask(with: request, resultHandler: { (response, error) in
guard let response = response else {
if error != nil {
self.alertView(message: error!.localizedDescription.debugDescription)
} else {
self.alertView(message: "Unknow error in creating task")
}
return
}
let message = response.bestTranscription.formattedString
self.label.text = message
})
}
I posted a stupid question, because I make some of the stupidest typos in my programming.
I just wish authors could delete questions/posts once we realize our silly typos.
I have no problem creating, and writing to AVAudioFiles.
do {
audioFile = try AVAudioFile(forWriting: destinationPath, settings: format.settings)
print ("created: \(curFileLinkName)")
} catch { print ("error creating file")}
But is there a way to close the file?
I've searched and all I could find was this very post on StackOverflow, which makes me wonder.
It's a small thing, but every time I open my current Xcode project the default iOS device to run my app on is my phone. Is there a way to change it to one of the simulators? i.e. iPhone Pro 11?
Correct me if I'm wrong, but with the latest version of Xcode (15.x) you can no longer add files to the iPhone simulator by dragging them into the the Files app.
I also tried to share the files from my Mac desktop to the simulator. But after selecting the simulator, absolutely nothing happened.
So I had to do it the long way:
Add a folder to the simulator with a unique name, in the Files app
Get the document path, print(URL.documentsDirectory.path())
Back track into the folder structure till I find that folder
cp the files to that folder
Please tell me that there is a way that I haven't found on Google, or that I somehow was doing what the Apple dox suggested, but missed a step.
Hello, Just starting to learn Xcode and I can test the first chapter's app on my iPhone if it's conncted via USB-C. The book walks me through the part where I can allow Xcode to connect to the iPhone via WiFi, just checking "Connect via Network."Yet Xcode cannot find my phone unless it's connected via USB. When I go to Devices that checkbox stays checked, unless I unplug the phone it which case that box doesn't even appear.And yes, they are both on the same WiFi, it's the only one I have and it's up and running.Any thoughs?
I have this long kludgy bit of code that works. I've outlined it below so as not to be confusing as I have no error within my code.
I just need to know if there's a method that already exists to copy a specific part of an AVAudioPCMBuffer to a new AVAudioPCMBuffer?
So if I have an AVAudioPCMBuffer of 10,000 frames, and I just want frames 500 through 3,000 copied into a new buffer (formatting and all) without altering the old buffer...is there a method to do this?
My code detects silent moments in an audio recording
I currently read an audio file into an AVAudioPCMBuffer (audBuffOne)
I loop through the buffer and detect the starts and ends of silence
I record their positions in an array
This array holds what frame position I detect voice starting (A) and which frame position the voice ends (B), with some padding of course
... new loop ...
I loop through my array to go through each A and B framePositions
Using the sample size from the audio file's formatting info, I create a new AVAudioPCMBuffer (audBuffTwo) large enough to hold from A to B and having the same formatting as audBuffOne
I go back to audBuffOne
Set framePosition to on the audio file to A
Read into audBuffTwo for there proper length to reach frame B
Save audBuffTwo to a new file
...keep looping
So like the title says, when I start up Xcode the preview won;t work till I run a debug session using the simulator.
Sometimes the debug session is unable to start the simulator, which I can start manually then run a debug session.
Once all the above is done, preview works.
Any idea what is causing this behavior?
It just feels as if my debugger is running super slow when I step over each line. Each line is doing string comparison, splitting text into words, really nothing fancy.
It appears that every time I hit F6, the Variables View (local variables) takes 4 seconds or more to refresh. But I don't know if that's the cause, or a symptom.
Just curious if anyone can shed any light on this.
Specs
MacBook Pro 2019
2.6 GHz 6-Core Intel Core i7
16 GB 2667 MHz DDR4
Sequoia Version 15.1.1 (24B91)
iPhone running app is 13 pro
18.1.1
Xcode Version 16.2 (16C5032a)
Debugger on Xcode 16.x is super slow and it turns out it's only this way when Xcode is connected to my iPhone via WiFi. If I disable WiFI on my iPhone everything is just fine. But that's not a solution.
An engineer posted this supposed solution, https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes.
Forgive me but that's not a solution, especially since we used to be able to shut off "Connect via WiFI."
I've seen so many posts here and everywhere else with no one stating any clear answer.
Does anyone know why has this been removed? And is anyone aware of it?
I've posted in the Feedback Asst. as many others have.
What gives?
So I believe my machine JUST updated to Xcode 16.3 (16E140). But it definitely just installed the latest iOS simulator 18.4.
However, now my preview will sometimes give me the error Failed to launch app ”Picker.app” in reasonable time.
If I add a space in my code, or hit refresh on the Preview, then it will run on the second or third attempt. Sometimes in between the refreshes, the preview will crash, and then it will work again.
Anyone else experiencing this? Any ideas?
Thanks