Posts

Post not yet marked as solved
13 Replies
5.3k Views
While testing Catalina, I noticed that some local snapshots now have suffix ".local" like this:com.apple.TimeMachine.2019-08-21-204446.localAnd I don't seem to be able to delete it with:tmutil deletelocalsnapshots 2019-08-21-204446What are these snapshots and how to delete them? Any info would be appreciated!
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
18 Replies
7.7k Views
On Mojave, my app needs a way to determine if the user has already added the app to the "Full Disk Access" list in System Preferences. (And if not, instruct him to do so).So far I've been using the following empirical test:int c = open("/Library/Application Support/com.apple.TCC/TCC.db", O_RDONLY);if (c == -1 && (errno == EPERM || errno == EACCES)) {// no full disk access}However it turns out that on a small percentage of systems, this test gives NO even when the app is already in the "Full Disk Access" list. I also noticed that on such systems, the folder /Library/Application Support/com.apple.TCC/ has access permissions 700 (drwx------), as opposed to "normal" systems where this folder has permissions 755 (drwxr-xr-x@). I guess this may be the reason why the test fails.Anyway, is there any API or a more reliable test to see if my app has been added to the "Full Disk Access" list in System Preferences?
Posted
by Sheldon15.
Last updated
.
Post marked as solved
2 Replies
331 Views
I've built a lightweight app that displays some advanced animated graphics UI using the Metal Kit Unfortunately, the app launches too slow. The app's icon in the Dock bounces 3-5 times, the icon's bounce animation is jerky, and also the whole Mac becomes temporarily sluggish and may become much less responsive for a few seconds. So it's not merely a matter of my app's launch-time optimization. Also I don't have this problem with other apps that don't use Metal. I narrowed down the problem and figured that the problem disappears if I comment out the code starting from -[CAMetalLayer setDevice:] in my -[NSApplicationDelegate applicationWillFinishLaunching:]. I also noticed in the Activity Monitor that when I launch my app, the kernel_task instantly becomes hugely active, taking up 100 or 200% of CPU, and quickly goes back to 3-4% after the launch is complete. This apparently causes the whole Mac to become sluggish temporarily. I have a theory that for some reason, macOS maxes out the kernel_task when my app calls the GPU for initialization. I know that the kernel_task is used to throttle CPU to avoid overheating, but my Macbook has normal temperature and no other CPU-intense tasks are running. I am running MacBook Pro (16-inch, 2019) 2.6 GHz 6-Core Intel Core i7 16 GB 2667 MHz DDR4 AMD Radeon Pro 5300M 4 GB Intel UHD Graphics 630 1536 MB Can someone please advise about the possible causes of this problem and how to deal with it? My app is extremely lightweight and I really want it to launch instantly.
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
1 Replies
2.9k Views
For some reason, a small percentage of Mac users don't have "en0" Ethernet port in their IORegistry. Therefore the Apple's recommended code for getting the computer GUID for receipt validation does not work:IOBSDNameMatching(master_port, 0, "en0");For obvious reasons, such users experience problems with many other apps from the Mac App Store and I believe with macOS itself too.However they do have "en1" (AirPort) and "en2", "en3" (Thunderbolt), but no "en0" (Ethernet) in the registry.In theory, I could use "en1" (AirPort)'s MAC address instead, but I can't make the Mac App Store do the same, to match the GUID hash in the receipt.So, what does Apple recommend for such cases for us developers? And what are the steps for the users to restore their system registry?Thanks!
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
2 Replies
1.7k Views
Is there an API to tell if a file is an APFS clone of another file in the same volume?With hard links, there were APIs (e.g. getattrlist or statfs) to tell how many links there are pointing to the same file (inode). Obviouslty, clones are using different inodes, unlike hard links. So how to tell how many clones there are for a file?
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
0 Replies
262 Views
I have received a message from Apple regarding the new "offer codes" that can be used to promote paid subscriptions: "Offer codes can help you acquire, retain, and win back people by letting them experience your subscription at a free or discounted price for a specific duration. At the end of the offer period, the subscription auto-renews at the standard price unless a subscriber cancels it or turns off auto-renewal." My app is a one-time paid app, not a subscription, but I also plan to release a new version of my app and submit it to the Mac App Store as a new product (think of it as a "pro" version of the same app), while also keeping the old ("classic") version around. I would like to offer the users of the "classic" version to upgrade to the "pro" version with a discount. So I was wondering if it's possible to use the "offer codes" for this purpose? That would be just perfect. If not, is there any alternative way to achieve my goal in the Mac App Store?
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
0 Replies
285 Views
I've built a small Cocoa app that uses OpenGL to draw some light content. I've used CAOpenGLLayer. While the app itself is very small and works blazingly fast, the launch time of the app is not satisfactory at all. At random times the app would stall for about a second or two upon launch, before showing the content.I've narrowed down the problem and found that the bottleneck is the CGLChoosePixelFormat() function that is called during OpenGL initialization. It literally takes ~1 second to execute.For a clean experiment, I created a blank Cocoa app and added an NSOpenGLView to the window. Immediately, the app launch time has grown by 1-2 seconds, for the same reason.Is there a way to fight this problem? There seems no way to avoid using CGLChoosePixelFormat(), it's essential for getting OpenGL to work on a Mac.Also, it's said that Core Animation is built upon OpenGL under the hood, but my Core Animation apps do not exhibit this slow startup problem at all. Also, I tried a symbolic breakpoint on CGLChoosePixelFormat in a Core Animation app, but it doesn't trigger. So Core Animation is either not using OpenGL or there is a way to initialize it in a different way. Does anybody has a solution?P.S. I know Metal is now the way to go for 3D graphics on Macs, but I need to do this particular project on OpenGL for backward compatibility reasons.
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
3 Replies
680 Views
My app is sandboxed (for submission in the Mac App Store).In one of the app's functions I need to execute a small bash script.I tried to use NSTask passing the bash script in one of the arguments. The task launches but unfortunately the script doesn't produce desired results due to sandboxing.I noticed that if I use NSUserUnixTask and launch the script from a SH file on disk, then the task launches and the script DOES produce the desired result.Unfortunately, NSUserUnixTask doesn't work if the script file is located inside the app bundle. The file must reside in ~/Library/Application Scripts/<bundle id>/ directory. My app already has read-write access to that folder (the user has granted it), so I thought that I could temporarily copy the bash script file there and launch it with NSUserUnixTask.However I wonder what are implications of such approach. Obviously, the script can be modified by other software and then my app would execute potentially malicious code. Even if I install the script only for a fraction of a second and remove it immediately after completion, the small theoretical probability that the code could be modified is not entirely excluded.On the other hand, NSUserUnixTask is SUPPOSED to launch scripts installed from the Application Scripts directory, isn't it? So perhaps it's supposed to be an OK solution?I wonder how the App Store review team would respond to the above solution. Is it prohibited or may be OK, should I even try?
Posted
by Sheldon15.
Last updated
.
Post marked as solved
1 Replies
556 Views
The APFS reference (https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf) mentions APFS volume roles, in particular System, Recovery, Preboot etc. (APFS_VOL_ROLE_SYSTEM, APFS_VOL_ROLE_RECOVERY, APFS_VOL_ROLE_PREBOOT)and I'm wondering what is the API function to query the role for a given APFS volume?
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
0 Replies
689 Views
I have used Instruments' Leaks profiler on the Apple's "HelloTriangle.app" sample code. I can see a lot of memory leaks, most of them happen in-[AAPLRenderer drawInMTKView:]and are related to allocating the command buffer and presenting drawables.What could be the reason and how to fix these leaks. Or is it bugs in Metal SDK itself?
Posted
by Sheldon15.
Last updated
.
Post not yet marked as solved
0 Replies
268 Views
I'd like to use the appearance of system buttons (NSButton, NSSegmentedControl) as much as possible, however I need to modify certain aspects of their appearance. Particularly, the background color (for example use one of the system "Accent Colors" as a pemanent color for my button, not only when it's pressed). My goal is to create buttons that look identical to the system buttons, and make sure that my button appearance doesn't get out of sync if macOS changes its visual styles slightly in future updates.Before Mojave, the only way to customize the buttons was to subclass NSButtonCell and in fact draw all fragments of the button appearance in code, from scratch. Is there any change in Mojave that would allow to better reuse the system appearance of buttons, and only modify it slightly?If it's still necessary to redraw the button background in code, are there any image files in system frameworks that could be used for reference? Or are the button images drawn by the system in code, by applying vector shapes?
Posted
by Sheldon15.
Last updated
.