I would like to understand if there is any way to write a real daemon (or service) running under iOS 4.x.
Note that I understand that the official SDK does not allow for such things to be distributed on the AppStore, but what if I wanted, for example, to distribute my app using the “enterprise” program to a set of employees?
And no, I do not want to Jailbreak my employees’ iphones.
I guess the answer is ‘sort of’. If you don’t want to jailbreak phones, your options are rather limited. As long as you’re only intending to distribute internally, you can look into the VOIP background services.
It’s part of iOS 4’s background services, and is intended to allow VOIP apps to run constantly in the background to pick up events such as incoming calls, etc. It is possible to use it to achieve other things, such as a regularly scheduled service (I think there was a recent question where somebody wanted to use it to act as a ‘data counter’, again for the enterprise program).
It’s not really a ‘correct’ or proper solution, but it’s the best you’ve got unless you want to jailbreak your phones – and it goes without saying it’s unsuitable for apps to be distributed on the store.