Not authorized to send Apple events in XCode

My OS X app requires disk access, scripting access, and creates virtual keyboard events. It runs fine with the release version that’s running in the Application directory, but when I try to run it from XCode none of these things work. When I run Applescript I get: Not authorized to send Apple events


I’ve added all the necessary permissions for my app as well as XCode. How can I get this working?

Not authorized to send Apple events in XCode
 
 
Q