Post

Replies

Boosts

Views

Activity

Sonoma extremely slow / hangs opening folders in ~/Library/Containers
My app iterates over all folders on disk and queries metadata of each folder. After Sonoma was released, a bunch of users (but not all) complained that the app has become very slow or stalls indefinitely while performing the scan. I have narrowed down that the delay occurs in POSIX open() function, and the folders it stalls on are folders inside ~/Library/Containers and ~/Library/Group Containers, which store data of sandboxed apps. My app is not sandboxed itself, and the problem doesn't happen on all Macs, only on a subset of Macs. I read it in WWDC transcripts that in macOS Sonoma, Apple has introduced additional privacy access control to these particular folders, and my guess is that the delays and stalling are related to this new macOS feature. Is anyone else is experiencing this problem? Can I do something to work around this problem? Or is this a bug of macOS Sonoma and I should report it to Apple?
1
0
1.1k
Oct ’23
Occasional pink frame in Metal on macOS Ventura (M2 Pro)
I am developing a macOS app which has a metal-backed view, based on CAMetalLayer. It worked fine on macOS Monterey, but after I switched to a M2 Pro machine and upgraded my macOS to Ventura (tried both 13.3 and 13.4), the view would randomly display a blank pink screen - as if the Metal is indicating an error or empty state. I don't get any log messages in the Console though. Particularly, the pink screen appears after I select the app's "Enter Full Screen" command. It appears only in ~1 of 10 attempts, and doesn't appear in 9 of 10 attempts. The pink screen goes away after the view renders its next frame (e.g. on mouse move). It's worth mentioning that the CAMetalLayer-backed view in question is hosted in the toolbar, so the issue is probably related to the fact that when an app switches to the full screen mode, macOS detaches the toolbar from the main window and attaches it to the separate toolbar window. I have tried to profile the app and catch the pink frame - particularly using -[MTLCaptureManager startCaptureWithDescriptor:error:], however when I analyze the trace, everything seems to be fine - all vertexes, textures and commands are being transmitted to the GPU correctly. However, on the screen, I still get the occasional pink screen. I wonder if anyone could give me hints as of why this might be happening and what other tools I can use to track down the problem? Or maybe it's a macOS Ventura bug? P.S. For brevity, I'm not attaching the code, which is too large and spread over multiple files to fit here. I'm interested in general advice.
1
0
1.3k
May ’23
Why proceeds in different currencies and countries are not equal for the same price tier?
I have always wondered how Apple calculates the price tiers for different countries and currencies. I'm well aware of the currency exchange rates and the fact that different countries have different taxes that must be taken into account. Usually, two models are used for this - tax inclusive and tax exclusive. In other words, either the end price is increased to include the tax (customer pays extra to cover the tax) or the price stays the same and the seller covers the tax by his own expense. However, in the App Store, neither of these two models are used - some kind of in-between model is used. The tax is included into the price, but only partially, and a part of the tax is still covered from the seller's expense. In particular, Apple has scheduled a price change on May 9. In the price tier $9.99 the price in EUR will become EUR 9.99, and consequently the sales in EUR will be anywhere from $8.7 to $9.2 (before Apple commission fee), depending on the country, at the current EUR/USD exchange rate. I would appreciate some explanation regarding the formula and the logic that Apple is using behind the pricing tier calculation. It would appear more logical to me that in countries which introduce higher taxes, the customers would have to pay more to cover their taxes, and not automatically take it from the proceeds of the seller. Or at least give seller a choice of how to include/exclude the taxes from the price. Thanks,
2
0
1k
Apr ’23
AppStoreConnect API: Customer reviews VS ratings, how to get the latter?
I use the following AppStoreConnect API endpoint to query customer reviews for my app: https://api.appstoreconnect.apple.com/v1/apps/id/customerReviews I notice however that in my AppStoreConnect dashboard, I have two different reports: the reviews and the ratings, and the number are noticeably different. My question is - what's the actual difference between the ratings and the reviews? As an App Store user, I can rate an app (give it stars), OR, I can write a review where I can also include a stars rating. Therefore, are ratings similar to reviews but without a message body? Do the ratings and reviews overlap, or are they totally different sets? Also, how can I get the ratings (as opposed to reviews) from AppStoreConnect API? From the above endpoint I only get reviews. I don't see any other endpoint in the API in the docs. Please advise, thanks!
0
1
852
Dec ’22
MetalKit app launches too slow, kernel_task kicks in and Mac becomes briefly unresponsive
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.
2
0
943
Oct ’21
Using the subscription "offer coders" for discounted upgrades?
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?
0
0
554
Nov ’20
OpenGL in Cocoa app: CGLChoosePixelFormat() is terribly slow?
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.
0
0
680
Apr ’20
Sandboxed app placing bash script to shared location for NSUserUnixTask - bad idea?
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?
3
0
1.6k
Feb ’20
Can't delete APFS local snapshots
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!
13
1
8.9k
Aug ’19
Reliable test for Full Disk Access?
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?
20
2
13k
Mar ’19
Receipt validation: no MAC address, en0 port missing in registry
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!
1
0
3.4k
Nov ’18
APFS how to test if a file is a clone
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?
2
0
2.7k
Jun ’17