title: pull notification locally on jailbroken device
body: <p>Since the iOS framework doesn't allow local notifications to execute code before they are posted, I'm looking for a way to achieve it on a jailbroken device.</p>
  
  <ul>
  <li>Is there built in functionally on a jailbroken device to schedule code execution with no need for the user to interact?</li>
  <li>The code should download updates and determine if the user should receive a notification.</li>
  <li>I <strong>don't</strong> want to use push notifications, which requires an external server to push them to the user.</li>
  </ul>
  
  <p><strong>Update</strong></p>
  
  <p>Well, I've managed to create a daemon which launches on start-up and keeps itself running.
  However, posting notifications requires the <code>UIApplication</code> object. According to the <a href="https://developer.apple.com/documentation/uikit/uiapplication" rel="nofollow noreferrer">documentation</a> this singleton is created by the <code>UIApplicationMain()</code> method which, for a regular application is called by <code>main()</code>.  Since I want the notification be posted by a daemon, the singleton is nil.</p>
  
  <p><strong>Can I create an instance of <code>UIApplication</code>? Or post the notification any other way?</strong></p>
  
  <p>I've tried calling <code>UIApplicationMain()</code> and then posting the notification in the app delegate, as well as killing the application, but this shows a black screen for a moment; I guess its launching the application.  Moreover, it causes the daemon to crash when app launching is impossible (when the phone is yet to fully boot).</p>
  
  <p><strong>Here is a sketch of the code</strong></p>
  
  <pre><code>int main(){
     if(launchedBySpringBoard || launchedBynotification)
        UIApplicationMain(...);
     else if(launchedByDaeamon)
        StartRunLoop();
  }
  
  void triggerdByRunLoopEveryXhours(){
      downloadData();
      if(isNewData())
         postNotification();
  }
  </code></pre>