I’m writing a daemon for jailbroken iOS and I want to set certain settings for it using a GUI. Is it possible to have a GUI for a daemon? If not, how can I write an app that can communicate with the daemon so I can control the daemon via the app?
Share
Yes, you can do this. I have multiple apps that consist of one normal
UIApplication, and then a background Launch Daemon that runs all the time.It depends on what kind of information you want to communicate between the two. One pattern I’ve used (there are many other ways, too) is to have a shared preferences file. I might store this file in
/var/mobile/Library/MyAppName/user_preferences.plist. The launch daemon will read this file, and the UI can write it.When the user changes some settings via the UI, your UI can write out the plist file with
writeToFile:atomically:inNSDictionary. It then needs to tell the daemon that it’s time to re-read the preferences file. You could do this with a notification. In the UI app:In your daemon, you would then register a callback method, or block, that would get invoked by iOS when the
com.mycompany.settings_changednotification was posted.The daemon’s
loadSettingsmethod can then read in the plist file withdictionaryWithContentsOfFile:.I’ll try to add some more description (and code) if I have more time later.