File logo

I cannot get my app logo attached to the sqlLite database file in Finder. How do I do this ?

you need to define your own file type in Xojo with your own file extension and icon.

1 Like

Thank you, and I’ve tried that but nothing seems to work? what UTI should I use to disguise a .rsd file, an SQLite database? Can anyone possibly send a screen copy of setting up a filetype for a SQLite database PLEASE?

The UTI should be something specific to your app. If your bundle iD was com.example.myapp then the UTI might be com.example.myapp.database. It will be much easier on you if you use a custom extension.

You’ll want to set the conforms to field to public.database if you think another app might be able to open it.

Check the box that says “this type is unique to my app” and add an icon.

When your app creates one of these files, use your extension. It should just work.

Something else to keep in mind… if you want to see an example of how other types are set up, drag and drop a file, folder or bundle onto the file types editor and it will extract the data for you.

It’s a good way to automatically add the things you need to support other things on macOS. Try it with a PDF file.

1 Like

OK, I really appreciate the reply from Greg, thank you, BUT I think my ‘Xojo amateur’ development status is stopping me understanding the reply. I am trying to set up a SQLite database as a unique file to my application, and I’m stuck. I don’t understand and can’t interpret the UTI, bundle ID, etc etc. IS IT POSSIBLE someone has set up a SQLite database before, and can send a screen copy of that filetype setup PLEASE?

Bill, I’ve got one here and will get it for you when I get to my desk, but if you are doing this, it’s really important that you understand what you are doing and how it works. Otherwise, you’re setting yourself up for pain later.

UTI stands for Uniform Type Identifier. It is meant to be unique for this particular type across all apps everywhere. This is why I suggested BundleID + type name.

The Extension is used for the file system to know which UTI to apply when a file is created by your app.

Now the UTI structure is hierarchical, which means that it can “conform to” other types above it. The base of which is determined by the type (on the right) of File, Folder or Package (a folder that looks like a file in Finder). Here I was suggesting public.database because that would allow other database editors to open your sqlite file through drag and drop or right clicking and selecting Open > some other app.

Role determines the role that your application takes in terms of this file. If your app can edit the file (or creates them) this should be Edit. Otherwise you can choose Execute (if the file represents a script of some kind), View (if your app could display PDFs but not edit them for instance) or None (if your app can open a file type but it isn’t its main function).

Rank determines how high up in the Open menus that your app will appear. Owner means “I own and create these files” which is what you’ll use in this case. Other possible values are Default which means “if there’s no owner, the user should choose me”, Alternate which means “I’m not the first app a user would choose, but if there aren’t any others, I can open it” and None which means “I can open this file, but don’t show my app in any of the menus or dialogs”.

Here’s an example of how you might set one up…

Just remember that you can only use ascii letters, hyphens and periods. Here’s what Apple says about this:

The identifier must contain only alphanumeric characters ( a - z , A - Z , and 0 - 9 ), hyphens ( - ), and periods ( . ). For example, you might use com.company.greatAppDocument or com.company.greatApp-document

2 Likes

@Greg_O_Lone can you make this a blog post?

1 Like

Thank you so much for this detail. I really appreciate the help. I tried to emulate your example, but I’ve done something wrong as it has failed. I suspect where you use “example” I should be putting a word in there, I just don’t know. Here is my attempt.

Yes, go look at your application identifier in the macOS build settings. It’s typically something like

com.yourdomainname.appname

Then this value would be

com.yourdomainname.appname-database

So I click on Build Settings/MacOS and I get this Inspector window [nothing like what you’re suggesting?

The bundle I’d really should be changed to a reverse domain as I suggested.

You’ll have more success that way.

Greg, I am very grateful for your time and your replies, but in all good faith, as a learner, I do not understand what you say. What is a reverse domain, where do I do what you say, and … WHY doesn’t Xojo offer HELP on these matters?[that last question is not for you😃]

@Bill_Snaith I understand that this is a difficult subject. But it is not Xojo’s “fault” it is what it is and the same if you would develop with Swift in Xcode, for instance. @Greg_O_Lone’s explanations are wonderful, and repeating it in a simplified “wording” makes it "faulty. But I will try to get you up and running. I refer to your picture above where you are naming the Bundle Identifier “ZEUS”.

ZEUS sounds like a good choice for you. But a bundle identifier should be unique and must be unique if you are deploying, for instance, to the Apple Store.

Now you can’t guarantee that I want to use ZEUS for my app, can you? (because I like “Zeus” as much as you do :wink: ). Now, we both have an issue: I may want to use ZEUS for my app, but you want this name as well.

Now the magic “trick” consists in using what most developers and businesses own: an own domainname on the internet. I own for instance: jeannot-muller.com . let’s assume your domain is: bill-snaith . com (note: I’m adding the spaces as this domain doesn’t exist). The magic trick of using reverse domain naming consists of using your domain as a prefix for your bundle but in a " reverse" order. So I would use for my app the bundle identifier:

com.jeannot-muller.zeus

and you will use:

com.bill-snaith.zeus

Now we are both enabled to use “zeus,” but the domain name ensures that I will not choose a name someone else on this planet might be using as well. Hence this whole topic is about conventions! Just name your bundle identifier according to this convention and logic, and you are safe.

If you don’t have your own domain, you will run sooner or later into issues as all stores will be asking you for some URLs for support, etc. But in the beginning, you can use a fantasy URL but still follow the conventions above.

1 Like

I hadn’t planned to get into this here, but if you’re planning to distribute your app on macOS at all and don’t want your users to get lots of security issues, you’re going to need to create an account at Apple so you can notarize your app. When you do this, you are going to run into this bundle identifier thing there and they definitely enforce their rules and make sure that it’s unique across their system. It may be easier for you in the long run to just get yourself a domain and an Apple account now while you’re still developing so you don’t have to go back and change all of this later.

2 Likes