You can run Xcode directly with sudo , then it will work with the privileges of your designated user, and your application will also work with the same privileges.
This may not be the best way; there might be a way to tell Xcode to launch your application in a certain way. But the above method will work anyway.
Greg hewgill
source share