Screensaver doesn't install in other machines Preferences Pane - xcode

I am writing a simple screensaver app. I run Product > Archive from Xcode, Distribute, Save built products and I get the .saver file. I then can install it with no problem on my development machine, while on other machines (64 bit, 10.7 as well) it doesn't install it.
Actually if I move the .saver file inside /Users/user/Library/Screen Savers/ and go to Preferences Pane, it complains saying: "You can't use this screensaver on this computer. Contact the developer for an up-to-date version."

I have been experimenting with writing a screensaver and get this warning scrolling in the screensaver preview panel if I use depreciated code - I usually find that looking into the Objective C reference there are suggestions of replacements to use
e.g. These are both declared in NSString.h
+ (id)stringWithContentsOfURL:(NSURL *)url NS_DEPRECATED(10_0, 10_4, 2_0, 2_0);
causes the warning
+ (id)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;
doesn't
Ctrl+click for menu then select jump to definition and then highlight and Alt+click to get suggested replacements

Related

xcode-cloud-assertion failures when testing Xcode Source Editor Extension

So I have a bare-bones Xcode project with an Xcode Source Editor Extension target attached. I'd like to test the thing, so I hit run. A new instance of Xcode pops up, where my extension should appear in the Editor menu, but there's nothing there. The logs show the following lines (among other things):
2023-01-20 13:44:24.240562-0800 Xcode[2203:46831] [xcode-cloud-assertion] ❌❌❌ Assertion failure #0 in Failed SW AuthKit for: <private>
2023-01-20 13:44:24.249980-0800 Xcode[2203:46831] [xcode-cloud-assertion] ❌❌❌ Assertion failure #0 in Failed to authenticate account: <private> error: <private>
For context, I'm running the following:
macOS 12.6.2
MacBook Pro (Retina, 13-inch, Early 2015)
Xcode 14.0 (14A309)
I'm not enrolled in the Apple Developer Program, and I've never used Xcode Cloud.
It's also worth noting that when I go to Reports > Cloud, I get Analyzing workspace... for a few minutes before Could not load Xcode Cloud data pops up (same issue as described here). I get similar behavior across all projects, including brand new ones. I'm not sure if that has anything to do with these log messages above, but I kind of hope it does.
I've tried the following:
Removing and adding my Apple ID in Xcode, restarting my MacBook in between
Deleting my development certificates
The main thing is that I'd like to be able to test my source editor extension. Any ideas?
Found it. The problem is XcodeKit, which isn't set to sign out of the box. I was able to fix it by setting it to Embed & Sign under General > Frameworks and Libraries > XcodeKit.framework (see screenshot).

Automatically allow app (built & run by Xcode) to control your computer

I am developing an assistive MacOS app in Xcode / ObjC.
It intercepts keystrokes using event-taps.
When I run it from Xcode, I get:
2019-07-05 06:20:32.423783+0300 mapper[8108:1191874] unable to create event tap. must run as root or add privileges for assistive devices to this app.
2019-07-05 06:20:32.423809+0300 mapper[8108:1191874] No Event tap in place! You will need to call listen after tapEvents to get events.
I have to go to system preferences -> security & privacy -> privacy -> {unlock the padlock putting my admin password} -> {locate, uncheck and recheck my executable from the list}, like so:
Every time I modify a line of code and run again I have to go through this process of checking and unchecking.
It is a very clumsy development cycle.
Is there any way to avoid this?
This project was using a 4-year-old Xcode project file.
Starting with a fresh Cocoa App template and copying the files in, the first time I build and run I am now automatically presented with:
... which takes me to the preferences pane and previous screenshot. Subsequent rebuilds do NOT require toggling the setting in this dialog. It is only if I "Clean Build Folder" that this process repeats.
My guess is that the improved behaviour may be because the new project is derived from a Cocoa App template (which inherits its base object from NSApplicationDelegate, whereas the old one inherited from a Commandline App template (and I had to manually manage the run loop with CFRunloop).
Getting mouse coordinates on Mojave contains an answer offering instructions on how to add a row to entitlements.plist:
The entitlement that allows an application to use the Accessibility API is the com.apple.private.tcc.allow entitlement (with a value of kTCCServiceAccessibility). As you can probably guess from the name it is only allowed on Apple signed binaries.

App installation request in osx

I have a nwjs app that was built using nwjs-builder to create mac application (MyApp.app) and then packed into dmg image with node-appdmg.
If i don't have any version of my app in Applications folder yet, I get this dialog when I double click on the app in mounted dmg image:
And when I click 'install' i get this:
Now my question is - can I control this behaviour somehow? Disable that installation offer, or find out how does it try to install and why does it fail? Could not find any clues inside generated build or in nwjs-builder or in node-appdmg.
Here is what I found. The dialogs and installation code is not a part of nwjs, but chromium (chromium.src/chrome/browser/mac/install_from_dmg.mm).
I found 2 ways to disable installation request.
Make dmg writable - add format: "UDRW" to appdmg settings.
nwjs accepts chromium arguments by 'chrome-args' key in manifest. Specify --no-first-run to disable installation request. But this is a risky way, no first run key might affect many internal processes.

Setting the Debug version of the Direct3D runtime won't stick

When I open the DirectX control panel and open the Direct3D 9 tab and set "Use Debug Version of Direct3D 9" and hit "OK" or "Apply," there are no errors. If I open the control panel again, it is back to "Use Retail Version of Direct3D 9." When I try to debug my application, I don't get any output from Direct3D.
When I last did this a few months ago, everything worked correctly and I got debug output.
Running the control panel as Administrator doesn't seem to make a difference and the registry key mentioned here http://www.gamedev.net/topic/514529-cant-use-debug-version-of-direct3d/ is set to one.
What else can I try?
Same thing happened to me. It looks like that TrustedInstaller took ownership of some registry keys (including HKLM/SOFTWARE/Microsoft/Direct3D which dxcpl modifies).
Found a solution here. You just have to change ownership of that regkey.
I've seen this happen and sort of collected best practices to try and get this thing working online - you can try it
1.) There's a separate control panel for x86 and x64 applications in DirectX, There is the DirectX Control Panel which comes with the sdk and there you can set to use the d3d debug runtime and the verbosity level. There is also an option for shader debugging and memory check.
2.) Link against d3dx9d.lib instead of d3dx9.lib
3.) Try adding #pragma comment(lib, "d3dx9d")
4.) Use #define D3D_DEBUG_INFO, but use that before including the d3d9 headers.
5.) Check the Use Debug Version of Direct3D 9 in the properties window like so
http://i.stack.imgur.com/WoZAH.png
6.) Use a tool like DebugView
Sources:
http://www.gamedev.net/topic/514529-cant-use-debug-version-of-direct3d/
https://gamedev.stackexchange.com/questions/24541/cant-get-debug-spew-for-direct3d9
for me the solution was this:
"Looking at the permissions on the key can you not hit the "advanced" button? then click the "owner" tab put a check in the bottom box, then highlight the administrators group, then check "take ownership"."
via: http://www.tomshardware.co.uk/forum/238556-45-cannot-modify-delete-change-permissions-registry
after doing this i was able to give my user full access to HKLM/SOFTWARE/Microsoft/Direct3D and then the ctrlpanel kept its settings.

Using OSX Security-Scoped Bookmarks in a Firemonkey app

I have been developing an OSX app with Delphi XE3 and running into various problems. The latest one is with the sanboxed version built for the Apple Appstore.
The user has to select an arbitrary folder and the app needs to get access to it. Since there is a problem with the OpenDialog, I had to turn to drag-drop functionality instead.
The user drags a folder to the app, the sandbox gives the app temporary access to it and all works properly.
To preserve the access to this folder when the app is restarted I have to use the so-called "security-scoped bookmarks"
I am having two issues with them:
1) How to add the "com.apple.security.files.bookmarks.app-scope" entitlement to an XE3 firemonkey app? It is not available in the Project Options->Entitlements. If I add it manually in the ".entitlements" file it gets overwritten when the app is built.
So is there a way to add a custom entitlement that is not in the list in the project options?
2) To create the bookmark I should use the NSURL.bookmarkDataWithOptions method. I think it should be used like this, but I am not sure of the exact syntax:
var
URL: NSURL;
Err: NSError;
Data: NSData;
...
URL := TNSURL.Create;
Data := URL.bookmarkDataWithOptions(NSURLBookmarkCreationWithSecurityScope, nil, #Err);
...
Maybe there should be a call to Wrap(...) instead of Create.
I have not yet experimented with it, because it is pointless without the answer to issue 1).
It seems no one has written anything about these problems for Delphi, but I hope someone here has experience with that.
Thanks in advance.
Edit:
For problem 1) I tried to add edit manually the ".entitlements" file in the OSX32 folder and set it to read-only to prevent it from being overwritten. It was too easy to be true of course, because the linker complained that the file can not be modified...
OK, I finally found the way to manually add entitlements that are not available in the Project Options > Entitlements.
Instead of selecting the "App Store" build in the Project Manager you have to select a Normal release build and deploy the application as usual.
The application gets deployed in the PAServer scratch-dir as APP package. Inside this package there is an "Entitlements.plist" file, which is in XML format and can be edited with a text editor. It is quite obvious how to add new entitlements once you open the file.
After it is edited, the app has to be code-signed manually and a package has to be prepared. It is slightly more complicated than using the Delphi IDE, but there are instructions about it on the Embarcadero and Apple websites and it actually went without problems.
Still haven't tried the bookmarkDataWithOptions functions.
An alternative could be to deactivate the checkbox for the entitlements-file in the deployment page.
But attention: Evry time you change between Build/Release or App Store/Normal, delphi activates the checkbox. That means you have to deactivate it again in the deplayment-page, to avoid the transfer of this file to the mac PC.
By the way: Do you have tryed meanwhile the StartAccessingSecurityScopedResource function?
In the MacApi.Foundation unit the function is not declared in the NSURL interface.
Do you have found a way to use this function?

Resources