In order to let the user select an Image File, we have to use code like this (copied more or less from Xojo's FileType documentation ):
Dim pngType As New FileType pngType.Name = "image/png" pngType.Extensions = "png" Dim d As New OpenDialog d.Filter = jpegType + pngType d.Title = "Select an Image" d.InitialDirectory = SpecialFolder.UserHome Dim f As FolderItem = d.ShowModal
In an application built with Xojo <= 2018r3:
This will immediately pop up on of these Mojave Security Questions: "Would you like to allow XYZ to access your Photos"?
In an application built with Xojo >= 2018r4:
Nothing special at the first glance. No security warning - the InitialDirectory shows and allows to pick a file.
What's special is that Finder shows a section "Media: Photos" on the left, as soon as we use a
.Filter for jpg, png, and probably other Picture/Image types.
That makes this "security warning" more obvious... With Xojo built apps (up until 2018r3), the Mojave-user always gets a warning (well, the first time the app is used) when trying to open an Image File. If this warning is accepted, one can select an Image from the Photos Library.
With Xojo 2018r4 built apps, the "Media: Photos" is there - but nothing will happen.
The trick is once again to add an Info.plist to the Xojo project containing:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSPhotoLibraryUsageDescription</key> <string>Allow photos to be selected from the photo library.</string> </dict> </plist>
To reset the access list to Photos in Mojave, you can execute this command in Terminal:
tccutil reset Photos
So in a "fresh start" (an app built with Xojo 2018r4 and this Info.plist):
Nothing special to notice at first - the .InitialDirectory shows an allows the Mojave-user to pick an Image File. If the user tries to use "Media: Photos" or "UserHome:Pictures" in Finder, the security warning will now show up (and if accepted, it's possible to select a Photo from Photos Library or the designated Pictures Folder).
Kind of what's expected - but I haven't found this information in the Xojo documentation.