I am a beginning Swift developer who inherited a macOS app that does screen and microphone recording.
At one point this app would prompt a new user to grant Microphone and Screen Recording permissions as soon as those activities were initiated. I received reports that a new version that I built was not prompting for microphone permissions. I did some testing on my own system and now am having those same issues where audio and screen recording activities do not prompt for screen recording.
I have tried various combinations of the tccutil command to reset individual and all existing permissions. I've rebooted numerous times and even cleared SMC but nothing seems to help.
Here is a snippet of code that I am using to start audio recording:
And here is the code used to take a screen shot of a window:
I am building with Xcode 12.3 and using Swift 4 -- I am not able to upgrade to Swift 5 at this point -- and am using Catalina 10.15.7.
As mentioned, I am new to Swift development and have exhausted all of my options. Is there any additional information that I can provide to help get this resolved?
At one point this app would prompt a new user to grant Microphone and Screen Recording permissions as soon as those activities were initiated. I received reports that a new version that I built was not prompting for microphone permissions. I did some testing on my own system and now am having those same issues where audio and screen recording activities do not prompt for screen recording.
I have tried various combinations of the tccutil command to reset individual and all existing permissions. I've rebooted numerous times and even cleared SMC but nothing seems to help.
Here is a snippet of code that I am using to start audio recording:
Code Block let settings = [ AVFormatIDKey: Int(kAudioFormatMPEG4AAC), AVSampleRateKey: 16000, AVNumberOfChannelsKey: 1, AVEncoderAudioQualityKey: AVAudioQuality.min.rawValue ] _recorder = try AVAudioRecorder(url: url, settings: settings) _recorder?.record()
And here is the code used to take a screen shot of a window:
Code Block static func generate(forWindow window: [String: AnyObject], mask windowMask: Bool) -> (image: CGImage?, window: CGRect)? { let windowId = (window[kCGWindowNumber as String] as! NSNumber).int32Value let rect = windowRect(forWindow: window) let option = windowMask ? CGWindowListOption(arrayLiteral: .optionIncludingWindow) : CGWindowListOption(arrayLiteral: [.optionIncludingWindow, .optionOnScreenAboveWindow]) var image = CGWindowListCreateImage(rect, option, CGWindowID(windowId), .nominalResolution) if image != nil { image = resize(image!) } return (image, rect) }
I am building with Xcode 12.3 and using Swift 4 -- I am not able to upgrade to Swift 5 at this point -- and am using Catalina 10.15.7.
As mentioned, I am new to Swift development and have exhausted all of my options. Is there any additional information that I can provide to help get this resolved?