WWDC gotchas for Xojo developers?

Security is good - we are always told that. But the new security is bad. Try

dim f as folderitem = specialfolder.applications

Or try to open any file in Catalina or save a file.

Why is it bad for the user to know which App is accessing which folder? It needs more effort from us as Devs but for the user, i think this is good to know.

These are the things we have noticed so far from our limited testing:

  1. FolderItem.AbsolutePath will return a different path for non system paths on the root volume.
    The path: Macintosh HD:Users:test is now Data:Users:test
    Not sure what happens if you already have a volume called Data.

  2. NSOpenPanelMBS crashes if you assign an empty string for the title.
    A Cocoa NSInternalInconsistencyException was not handled: Invalid parameter not satisfying: aString != nil

  3. DomainLibraryFolderMBS(-32767) which we have used to retrieve the system’s Library folder now returns Nil.

The user either gets confused by the dialogs and clicks no. Resulting in support tickets or frustrated users. Or the user gets so used to click okay to these dialogs that they won’t matter at all.

Why would I need an extra dialog when I already double-clicked the file? Or did a save-as dialog???

There may be changes in the next beta …

@Kevin Gale: good catch with the DomainLibraryFolder.

My app can write files to a folder. I select the folder with a SelectFolderDialog. The dialog doesn’t trigger then security dialog and therefore I can’t write to the folder. Is this a bug? A missing feature? Or do I just give my app full hard disk access?

What is the absolute minimum for triggering the security dialog?

The following dialog only makes an IOException (signed app, debug with signing):

dim f as FolderItem = GetSaveFolderItem("", "test") if f = Nil then Return try dim b as BinaryStream = BinaryStream.Open(f) if b = Nil then Return b.Write("test") b.Close catch err as IOException MsgBox "IOException" end try

The second try works fine but doesn’t trigger the dialog:

[code]dim theDialog as new OpenDialog
Dim pngType As New FileType
pngType.Name = “png”
pngType.Extensions = “png”
theDialog.Filter = pngType
theDialog.PromptText = “Select a png file”
dim pngFolderitem as FolderItem = theDialog.showModal
if pngFolderitem = nil then exit

try
dim b as BinaryStream = BinaryStream.Open(pngFolderitem)
dim s as String = b.Read(10)
MsgBox s
b.Close
catch err as IOException
MsgBox “IOException”
end try[/code]

Is GetSaveFolderitem too old? Why don’t I get the security dialog in the second piece of code?

I know you are all trying to get Xojo working on 10.15, but keep in mind that we haven’t finished our notarization pipeline for the app yet.

And to be clear, Apple’s NDA clearly states that you may not discuss betas with anyone who is not part of the beta program. Since that cannot be guaranteed for the entire membership of our forum, it shouldn’t be going on at all.

Like last year, it’s fine to send us private messages, but we really won’t be looking at 10.15 bugs until Apple releases Developer Beta 3 or 4 since that’s when the big regressions usually settle down. Please don’t start filing bugs in Feedback quite yet.

Perhaps move the discussion into the Pre-releases channel?

Beatrix, why do you use Open and not Create function for writing file?

In a French web site, they said macOS Catalina have the boot files on a secure partition while the datas will be in a Datas partition.

All of this is unclear to me…

This is like in iOS. The /System folder is on a readonly partition.

@Greg O’Lone : we are not only talking bugs here. But a lot has changed and I’m still trying to figure out how to deal with the changes. Unfortunately, my app is currently in beta stage. So for me the time to fix these problems is right now.

@Christian Schmitz: yes, that actually seems to be a bug - or at least major stupidity - that this worked in Xojo until now.

So I still don’t know what triggers those security dialogs. Working with files works fine, though.

What does’t work is saving folders to the preferences and recalling them. Why doesn’t the following code work:

[code]SmartPrefs = new SmartPreferences()
dim f as FolderItem = SelectFolder
dim t as string = f.GetSaveInfo(volume(0))
SmartPrefs.Value(“folder”) = EncodeBase64(f.GetSaveInfo(volume(0)))

dim s as Variant = SmartPrefs.Value(“folder”, Nil)

dim FolderFromPrefs as FolderItem = Volume(0)
dim theSaveInfo as String = DecodeBase64(s)
FolderFromPrefs = FolderFromPrefs.getRelative(theSaveInfo)[/code]

SmartPreferences is macOS based code from Thomas Tempelmann to save and read preferences. FolderFromPrefs is nil at the end of the code.

That doesn’t help. We still can not guarantee that everyone there is an Apple Developer.

As I mentioned earlier, we should at least wait until Apple releases their first Public Beta and see if they relax the rules a bit.

[quote=440616:@Greg O’Lone]That doesn’t help. We still can not guarantee that everyone there is an Apple Developer.

As I mentioned earlier, we should at least wait until Apple releases their first Public Beta and see if they relax the rules a bit.[/quote]
I think the idea to move this to pre-release channel is to avoid the possibility for Google to parse/index this thread. Several people have their faces as avatar and the forum will show the name and initial for last name (in most cases).

Yes, is better to wait to talk about the future OS when you are not under NDA but to help Xojo’s users either move to pre-release or delete the posts that are breaking Apple’s NDA.

I’m not Apple Developer.

I accept that Apple are clearly saying that we shouldn’t discuss the betas or post screenshots etc etc but I’m a little curious - didn’t they totally relax this a few releases ago? Or am I thinking of something else?

It’s all a little silly from Apple because pretty much everyone in tech is discussing the betas in-depth, from Jamf to the Visual Studio devs to podcasts and YouTube videos. But I accept that Greg is recommending we do the right thing here.

[quote=440604:@Beatrix Willius]
What does’t work is saving folders to the preferences and recalling them. .[/quote]
The correct way to read and write preferences files is using CFPreferences or NSUserDefaults
Apple has said the repeatedly and apparently now is enforcing it

Do you get warnings when you alter a preference in the IDE (which DOES use CFPreferences ?)

@Norman Palardy : the example code uses macOS lib which uses the officially sanctioned methods. My app uses the MBS plugin. I just wanted to post code that doesn’t use a plugin. The MBS plugin uses CFPreferences. This works fine for files and fails for folders.

But the IDE is a good testing bed. This saves a folder just fine. I used the “Build Unsaved App is” preferences and set it to Desktop.

So what am I doing wrong??? Could it be the GetSaveInfo? But surely the IDE is using this, too.

By the way: +1 for Gavin. We need to discuss this stuff.

[quote=440629:@Beatrix Willius]@Norman Palardy : the example code uses macOS lib which uses the officially sanctioned methods. My app uses the MBS plugin. I just wanted to post code that doesn’t use a plugin. The MBS plugin uses CFPreferences. This works fine for files and fails for folders.
[/quote]
I have to admit I read this several times trying to figure out what you meant
CFPreferences reads / write to a single plist file in the Preferences dirs (either /Libary/Preferences or ~/Library/Preferences)
I have no idea what you mean by [quote]This works fine for files and fails for folders.[/quote]
CFpreferences doesnt write folders so … can you clarify ?

Nothing special that I can recall
You could inspect its plist to see if there are any special entitlements but I dont think there are

While I understand your idea, that tries to transfer the responsibility to Xojo instead of leaving it where it legally belongs… with the developers who agreed to Apple’s NDA when they download from their site.

If you don’t want to risk Apple cancelling your developer account don’t openly discuss products that they’ve got an NDA on until Apple tells you otherwise.

As I said earlier, once the betas settle down a bit (beta 3 or 4), we’ll start accepting private bug reports.