Persist accessibility permissions between builds in xcode 13 - swift

I am building a window manager that requires the use of the Accessibility API for macOS. My code works fine if I build the app, grant the debug build accessibility permissions in the Security and Privacy panel, and then run my code. But if I change any code, I have to regrant the permissions manually and it is incredibly laborious to do between each build.
How can I persist the permissions between builds? I see this is an issue elsewhere and I have tried all the tactics I found on Stack Overflow so far.
Auto allow access to MacOS accessibility API during development
MacOS Monterey 12.2.1 Keeps Asking for Accessibility Permission for an App When Launched from XCode 13.2.1 Even After Granting the Permission
How to prompt for accessibility features in a macOS app (from the AppDelegate)?

Figures I would solve this right after I post it.
The App needs to be signed with a certificate following this process to keep continuity between builds.
If your Apple ID is already hooked up to XCode and you have a developer account, I went to the "Signing and Capabilities" section in the App Targets section and updated "Signing Certificate" to "Development".

Related

MacOS Monterey 12.2.1 Keeps Asking for Accessibility Permission for an App When Launched from XCode 13.2.1 Even After Granting the Permission

When I launch an app from Xcode in order to debug, it keeps asking accessibility permission even after granting it.
If I archive, run from finder, and grant accessibility, it works fine.
I also tried removing the app from security & privacy.
It used to work fine in MacOS 11, but it doesn't seem to work with MacOS 12.2.1, Xcode 13.2.1.
I'd appreciate any tip.
It seems like you can't have duplicate versions of same app running around in your machine. Once I deleted all the debug builds as well as the release in /Applications folder, it worked.
Maybe you can allow only one file with same app name.

Swift app debugging: call to NSWorkspace.shared.open on OSX 10.15 denied

I have a piece of code, which opens a folder in finder:
NSWorkspace.shared.open(URL(fileURLWithPath: outputDir))
Under Catalina (OSX 10.15), this access is denied. I need special rights for this app. But how can I do this? I opened Security settings and added my compiled app to "Full Disk access" and "Files and folders" (I'm using a german OS; so text may differ!)
Whenever I rebuild my app, is it the same app or how can I debug without assigning the newly created app again and again?
Professional apps offer a managed tour for the user to drop their own app icon into the security area. Is this available anywhere as code, so I can use it too?

Could not code sign a Mac App

I successfully submitted my app [ version 1.0 ] to iTunesConnect for review. And they have rejected it because I have added an extra App Sandbox feature. So I solved that thing and tried to archive my project in new build number.
Also I have selected my Code Signing Identity 3rd Party Mac Developer Application, And came back to Project Settings -> General, now I could see that the Signing switched to None and Team automatically changed to None. So I have changed that to My Team Name and Signing into Mac App Store. Now I have went back to Project Settings -> Build Settings, There the code signing identity has different identity selected [ Two Mac Developer & One 3rd Party Mac Developer ].
So what happens is that whenever I change something the opposite happen in other place. Basically I am unable to archive my project cause of code signing issue.
If I try to code sign using Mac Developer Identity, it shows me something that I never seen before.
Something like error: A cryptographic verification failure has occurred.
*** error: Couldn't codesign /Users/Alvin/Library/Developer/Xcode/DerivedData/MyApp-bjtynsmrmxhrfffdvpfwxeanbgkb/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/Contents/Frameworks/libswiftCore.dylib: codesign failed with exit code 1
So how will I solve this problem? Thanks in advance.
By the way, I am using Xcode 7.3.1 in macOS Sierra. Is that can be a problem? No right?
It seems there may be code signing issues with macOS Sierra. You can follow the issue here.
I would recommend reverting back to El Cap and only installing an early beta of a new Mac OS on a machine used for testing the OS, not one you are doing active development on.
[update 7/6/2016]
Some developers are reporting this fixed with macOS Sierra Beta 2 and Xcode 8 Beta 2, but I have not yet comfirmed on my spare Mac if this fixes the problem.
Also, some developers have reported that resetting the Keychain fixes is. In the Keychain Access app , go to "Preferences..." and click "Reset My Default Keychain".

How to run phonegap app in iphone simulator?

I'm new in Xcode. I'm having Xcode 4.6 and Mac OS 10.7. I have setup the phonegap environment to my Xcode and can create my phonegap app successfully.
My problem is, when I start to run my app into simulator it's showing the following error:
Developer Tools Access needs to take control of another process for debugging to continue. Type the name and password of a user in the "Developer Tools" group to allow this.
and also showing the username & password textbox.
I have tried to give apple develoer credential and also system credential but not getting any solution.

Why do I get a "security policy error" when launching my iPhone OS app?

I created an iPhone OS 2.2 app some time ago and recently installed the 3.1 SDK.
When I try to run my app on my (3.1) iPod Touch, the launch window says "Error from Debugger: Error launching remote program: security policy error."
Viewing the iPod Touch's Console (via the Console tab for my device in Xcode's Organizer) shows:
Wed Feb 3 23:29:17 unknown SpringBoard[24] <Warning>: Unable to launch com.blahblah.Blah_Blah because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.
Wed Feb 3 23:29:17 unknown com.apple.debugserver-43[789] <Error>: error: unable to launch the application with CFBundleIdentifier 'com.blahblah.Blah_Blah' sbs_error = 9
I already sifted through a bunch of code-signing issues just to get it to build and deploy, so I think this might be something else.
After trying the above solution of deleting expired certs, I was still encountering this issue. Turned out I needed to launch the application manually once and accept the prompt asking if I really wanted to launch that application signed by that profile with that dev account. After accepting that, Xcode was able to successfully launch it subsequent times.
The solution for me was to delete all expired provisioning profiles on the device (even unrelated ones) Window -> Organizer - choose your device and under profiles delete any that have expired. Thanks to:
"security policy error" on iPhone and iPod Touch
The problem turned out to be spaces in the executable's filename (I think).
I had previously sorted out a similar problem with bundle identifiers by appending ":rfc1034identifier" to PRODUCT_NAME in my info.plist, but this is a little different.
I'm not sure how to set the executable name directly, but I eventually just changed the Product Name in the "Packaging" section on the "Build" tab for my Target to something that didn't have any spaces. Fixed!
I had the same problem when trying to run on my "newest" iPad after adding the device in XCode. Apparently this device was not in the list of devices for the development profile I was using.
Solution: go to iOS Provisioning Portal, select "Provisioning" on the left hand size, select the 'Development" tab on top and change in the applicable profile in the list on Edit/Modify
Then you can edit the settings for the Certificates to use and add the individual devices.
Then once you connect the device with the XCode organizer, the info on the device will sync automagically. You may then also want to remove the outdated profiles in the Organizer.
Problem solved.
Fixed this issue myself.
Go to Organiser Window
Select Provision Profiles from the left hand side
Press the refresh button in the bottom right of the window
punch in your AppleID and password
Feel free to recompile your app
My issue was I updated my profiles to add new devices but did not update the profile in XCode.