(i can't test it myself due to experiencing this bug: https://developer.apple.com/forums/thread/708050)
Post
Replies
Boosts
Views
Activity
it seems deleting everything in the xcode Derived Data folder, and deleting my app from system preferences → security & privacy → privacy → accessibility, and then re-adding has fixed it
(i had two apps with the same name so perhaps that caused it to bug-out)
EDIT: with further testing it seems now occasionally i need to remove the app from system preferences → security & privacy → privacy → accessibility to get it to work
Even setting the pasteboard fails:
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
let prevClipboard: String = NSPasteboard.general.string(forType: .string) ?? ""
print("prev: \(prevClipboard)") // returns "string 1"
// modify clipboard from "string 1" to "string 2"
NSPasteboard.general.setString("string 2", forType: .string)
let newClipboard: String = NSPasteboard.general.string(forType: .string) ?? ""
print("prev: \(newClipboard)") // returns "string 1" (not "string 2" as it should, thus it shows i am unable to modify the clipboard)
}
}
yeah i was so surprised they had the 'focus' feature but not a way to actually block apps instead of just hiding them.
in this day and age with everyone being addicted to their phones/computers we really need a way to fight against it; especially now that a lot of people have to work from home making it even harder to fight the distractions.
as they say, modern problems require modern solutions