Post

Replies

Boosts

Views

Activity

Reply to Swift InputStream.hasBytesAvailable() returns false when reading a file on the desktop in swift how do I fix this?
Thanks for the reply @eskimo! So if I use NSOpenPanel() in my finder sync file and the user selects the home folder, will that give my app access to all sub folders and files and they won't have to give that permission again? Would you say this is a better approach than trying to use a temporary exception entitlements? I don't plan on shipping the app on the Mac App Store. Also thanks for the notice about InputStream. This is what i'm trying to use now but it just produces a very buggy and unusable window and I can't get the window to show when running it in override func beginObservingDirectory(at url: URL) {} class FinderSync: FIFinderSync { override init() { super.init() // Check if there is a previously selected folder URL let defaults = UserDefaults.standard guard let selectedFolderURL = defaults.url(forKey: "selectedFolderURL") else { // Show the NSOpenPanel to select a folder let openPanel = NSOpenPanel() openPanel.canChooseDirectories = true openPanel.canChooseFiles = false openPanel.allowsMultipleSelection = false openPanel.prompt = "Select a folder" if openPanel.runModal() == .OK, let url = openPanel.urls.first { // Store the selected folder URL defaults.set(url, forKey: "selectedFolderURL") } return } } Thanks for your help.
May ’23
Reply to Swift InputStream.hasBytesAvailable() returns false when reading a file on the desktop in swift how do I fix this?
How do i get this pop up to show up to show when i run the app for the first time? “AAA” would like to access files in your Desktop folder. [Don’t Allow] [OK] In your thread it makes it seem like it should just appear when the application tries to access a file on the desktop but is there anything else i need to do to get this popup to appear? Again thanks for the help :)
May ’23
Reply to Giving my app read access to the Desktop/ Documents of the current user
Ok, so to clarify. I need to add a temporary entitlement to disable the sandbox restriction. And then I need to get a Developer ID signing identity to remember the answer to the MAC check. However I do not need to have a Developer ID signing identity to prompt the MAC check? From what I understand I should be getting a MAC check even if it doesn't remember my answer, but I am not when trying to access the desktop.
May ’23
Reply to App Crashing on any Mac that hasn't run the app in XCode Debug mode.
Amazing thanks, fixed the issue. I used atos -o /Applications/JDO-Share\ DY\ 3/JDO-Share.app/Contents/MacOS/JDO-Share -l 0x106b6b000 0x106b779f8 in the terminal to decode on the machine that the app crashed on and found that I was not handling if an account being passed into a function later on in the code was nil. Running it on the machine that crashed I think was the key otherwise atos didn't seem to work and just returned the memory address. I also made sure I was signing the app with a Developer Apple ID provisioning profile and a Developer ID application certificate and switched print to os_log. Thanks!
Jun ’23
Reply to Programatically changing the brightness of your Macbook
Hi all, I have found a solution that works well. If you create a shortcut on your Mac like this. then you can run it as a terminal command from swift like this. func setLaptopBrightness(brightness: Float){ let command = "shortcuts run 'Set Laptop Brightness' <<< \(brightness)" let _ = shell(command) } or directly from terminal like this shortcuts run 'Set Laptop Brightness' <<< 0.5 It works well for controlling your MacBook brightness programmatically until Apple lets us do it directly via Swift. Thanks, James
Sep ’24