For the same error, In my case, the answer was very simple. The first time I got it, it was because I had changed to a mac mini with no inbuilt mic, so adding a USB mic worked. The second time I changed to a bluetooth mic and had to change back to the USB one. I'm using AudioKit. If anyone knows what to do about the Bluetooth mic problem (I think, changing the sample rate might help, how??) then that would really help me.
Post
Replies
Boosts
Views
Activity
This worked for me, based on the same problem. (Thanks for the idea)
Created a dummy object class
class DummyObject: ObservableObject { //Forces a change to an object so that it updates
@Published var pickerId:Int = 0
init() {
dummyFunction()
}
func dummyFunction() {
self.pickerId += 1
}
}
Create an instance of this object in the main view:
@ObservedObject var dummyObject = DummyObject()
Attached that to the picker that needs to be updated using
.id(dummyObject.pickerId)
then created a function that runs when the controlling picker (not the updated picker) is changed and includes the dummy function which updates the id of the picker that needs to be updated and forces it to be re-calculated.
It works, but there must be an easier way..
This works for my view, in Xcode 13
The only problem is the upside down portrait mode view
struct ContentView5: View {
var body: some View {
ZStack {
(
Text("Hello, World!")
)
.onAppear() {
let value = UIInterfaceOrientation.landscapeLeft.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
.onDisappear() {
var value = UIInterfaceOrientation.portrait.rawValue
if UIDevice.current.orientation.isPortrait
{
UIDevice.current.setValue(value, forKey: "orientation")
value = UIInterfaceOrientation.unknown.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
else
{
value = UIInterfaceOrientation.unknown.rawValue
}
}
}
}
}
Doc:
https://developer.apple.com/documentation/uikit/uiinterfaceorientation
Make sure that you have a microphone, I have this issue because i dont have a built in mic.