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?
-
Seriously. Who is voting to close this question without posting constructive feedback? – Nate Nov 25 '12 at 00:43
-
Hi @Nate, the question is *extremely* broad, open-ended, with no signs of research or attempt from the asker to try the problem himself. The best questions on Stack Overflow are about a real, actual problem being faced, and this means getting stuck somewhere with some code to post, along with error messages. With that said, the question could be edited to provide more specifics, but I still think that involves making attempts at the problem so that it's narrowed/less broad. Hope this helps! – jamesmortensen Nov 25 '12 at 02:39
-
@jmort253 Sorry if this question seems open-ended. From reading Nate's answer, I think he understood it. I have a daemon that takes a screenshot of the device periodically and I want a way in the UI to set the frequency. So the problem boils down to how to write a UI that can communicate with a daemon. I'm not sure if this detail helps clarify things. I'd love to hear suggestions. – ssong Nov 25 '12 at 18:40
-
Hi ssong, don't get me wrong, I think you can still salvage this question and possibly get it reopened. Stack Overflow strives not just to be useful to you, but also to all the future visitors that will find your post on Google. Think of it as [your way of giving back to the community, even if you can't answer questions](http://meta.stackexchange.com/a/152512/155826). I suggest editing your question to include more detail about your problem and maybe some things you've tried, which will help others find your post, and Nate's answer. :) Good luck! – jamesmortensen Nov 25 '12 at 20:20
-
1@jmort253, sorry, that doesn't help. This question is not broad. It's extremely specific. Read it again. He's asking about inter-process communication between a UI application (which has a very specific meaning in iOS), and a daemon process (which also has a very specific meaning in iOS). There's nothing broad about that. Research? He's not going to find anything. This is a jailbreak-specific question. Apple does not support what he's doing on iOS, so their docs will be of no help (to start). The jailbreak community also has very little public documentation, and I've read most of it. – Nate Nov 25 '12 at 22:51
-
1How is he going to show any code if he doesn't even know which technique to use? *"The best questions ..."* So what? So now, if a question isn't *the best question*, it gets closed within hours? That's ridiculous. What is downvoting a question for, if you're just going to **close** questions that you don't understand? On that topic, I notice that you have basically no rep points in either the `jailbreak`, `iphone-privateapi`, **or even `iOS`** tags. Just because you don't understand the topic, don't penalize people trying to get some work done on this site. Just leave it alone. – Nate Nov 25 '12 at 22:53
-
Hi @Nate, if you think this should be reopened, I encourage you to create a [Meta Stack Overflow](http://meta.stackoverflow.com) post and make a constructive case for it. Perhaps other like-minded iOS people will get involved and think of ways to make this more clear that it shouldn't be closed. Closure isn't permanent; however, not every question is a good fit for Stack Overflow. Good luck! – jamesmortensen Nov 25 '12 at 23:33
-
@Nate thank you Nate for your response which is really helpful, I have posted another question, can you please reply me over there ,I am really struck.. http://stackoverflow.com/questions/15426148/jailbreak-development-using-xcode – Vishal Singh Mar 15 '13 at 06:32
1 Answers
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:
in NSDictionary
. 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:
#import <notify.h>
notify_post("com.mycompany.settings_changed");
In your daemon, you would then register a callback method, or block, that would get invoked by iOS when the com.mycompany.settings_changed
notification was posted.
int status = notify_register_dispatch("com.mycompany.settings_changed",
¬ifyToken,
dispatch_get_main_queue(), ^(int t) {
NSLog(@"settings notification received");
[self loadSettings];
});
The daemon's loadSettings
method can then read in the plist file with dictionaryWithContentsOfFile:
.
I'll try to add some more description (and code) if I have more time later.

- 31,017
- 13
- 83
- 207
-
Thanks for the detailed response! This seems like what I'm looking for. I'll try it out! – ssong Nov 25 '12 at 18:34
-
hey Nate I am very new to jailbreak coding and cant see anyway to start off. I have a jailbroken iPhone3G. I see some tutorials using theOS. Can you give me a brief how can i start off? What are the tools?? Xcode can be used? Where do we declare classes and how jailbreak classes differs from normal classes? – Vishal Singh Mar 02 '13 at 12:35
-
1@iVashal, I don't use theos, so I can't help you on that one. I would google for `theos tutorials` and see what you find. Xcode **can** certainly be used for jailbreak development. You normally just **Don't Code Sign** in Xcode, and then [fake code sign later with ldid](http://stackoverflow.com/a/12773253/119114). Jailbreak classes aren't any different. It's just that if you're developing for jailbroken phones, you have access to Private APIs, and other iOS features, that don't work for apps running in the normal sandbox. – Nate Mar 02 '13 at 21:46
-
1Also, if you're talking about making *tweaks*, that's a subset of jailbreak development, and a different story. If you have more *specific* questions, I would post them here (on stack overflow) as new questions. Comments aren't really good for continuing discussions. Thanks. – Nate Mar 02 '13 at 21:52