Cocoa reinstalling the application

I would like to determine if my application has been "reinstalled". Currently, my installation of the application only means a copy of the / Applications folder.

I would like to determine if someone uninstalled the application and after some time he installed it again.

Do you have any ideas how to solve this?

+4
source share
3 answers

I would like someone to delete

You can use FNSubscribeByPath (Deprecated in OS X version 10.8.) To view the garbage bin.

I would like to determine if my application has been "reinstalled"

You can create one file in the application support folder (your application folder) and access this file. Record the version number of the application in this file.

+2
source

Your application is just a folder on the HDD / SSD, so the user can manipulate it like a regular file. The user can place your application in ~ / Applications / MyStuff, make 300 copies of your application and launch them immediately.

The only thing you can check is the version of the application for the package. Read the version from the user defaults (written by the previous lauch application) and compare with your own version of the package. This can be useful for updates to determine which resources can be updated or created.

+1
source

How about checking for an existing settings file or expected user default settings?

This will give you a hint that has been installed recently - several people are clearing the settings folder.

0
source

Source: https://habr.com/ru/post/1483517/


All Articles