I am trying to build a utility application on macOS to manage a number of Safari windows and/or tabs.
The first task that stumps me is opening a new window.
I went back to the basic, created a new "Safari Extension App" project in Xcode 13.2.1.
The sample code includes
SFSafariApplication.showPreferencesForExtension(withIdentifier:)
and that works fine. But when I add my call to :
SFSafariApplication.openWindow(with: URL(string: "https://www.apple.com")!)
then nothing happens.
I tried adjusting the content of NSExtension in the Info.plist of the web extension handler, and a number of other things in the manifest, I verified that my extension was well loaded and active, but without any success with openWindow.
Is there any obvious caveat I should be aware of when dealing with SFSafariApplication?
Among other questions, should openWindow(...) be in the main app, in the native extension, or either?
Post
Replies
Boosts
Views
Activity
Summary
Non-empty APFS volumes with 'Reserve Size' prevent containers from creating other 'Reserve Size' volumes.
Description
When calculating the free space available inside a container, diskutil/Disk Utility.app seem to remove the entirety of the reserve size PLUS the entirety of the used size.
I would expect instead to remove the max(reserve size, used size).
Note
This disk is not backed up by Time Machine and has no local Snapshots. That is not the issue. I checked.
Steps
start with 1TB external HD
format as APFS, delete any volume if created automatically.
create a first volume 'VolumeA', with 500 GB Reserve Size and no quota. Should succeed.
create a second volume 'VolumeB', with 500 GB Reserve Size and no quota. Should succeed.
delete VolumeB, inspect available size on Container, find 500 GB
use 100GB on VolumeA with random data using command
dd if=/dev/urandom of=/Volumes/VolumeA/HundredGBFile bs=100000000 count=1000
now try recreating the same VolumeB as in step 4, with 500 GB reserve. This fails for me in 10.15.7/11.4, with an error There is not enough free space in this APFS Container for this operation. : (-69605)
run 'diskutil apfs list' and notice that the Container's Capacity In Use By Volumes: is now 600 GB, even though the VolumeA is clearly only using 100 GB, not 600
Conclusion
In the current version of the OS, if one wants to use multiple volumes with 'Reserve Size' enabled to reserve most of the space available in their container, volumes mayneed to be created before the data written to disk is larger that the total non reserved space.
This is an edge case for most users, but I still think the calculation of the amount of free space at the container level is currently wrong and should be fixed.