Can an iPhone application relaunch itself when terminated?
<p>Thanks for the suggestion well i am writing in detail about it.</p>

<p>I have a requirement to do in my project like this,</p>

<ul>
<li>When the app launch for the first time it should display the device native dialer and then check for callDidConnected in background.</li>
<li>once the callDidConnected is true app should launch itself.</li>
</ul>

<p>Here I tried a logic to do so. please have a look to the pseudo code.</p>

<pre><code> - (void)applicationDidFinishLaunching:(UIApplication *)application {


 //i am dialing to a IVR from the native dialer

 if (/* A check to validate wether to call or not */)
 {
    NSLog(@"Dialing");

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:"]];


    // A loop check wether the call get connected  
    while (!callDidConnected){
  callDidConnected = // doing a check with server
    }

    // if call get connected then launching my application
    if (callDidConnected){
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"MyApp:"]];
 }

 }

 else
 {
  // normal app
 }
}



 - (void) applicationWillTerminate:(UIApplication *)application
{

}
</code></pre>

<ul>
<li>I registered the app with URL MyApp.</li>
<li><p>Well I tested this code on simulator(on SDK 3.0/3.2) with opening another app(tried http instead of tel protocol). The check executes in background while other native app(safari) run in foreground.</p></li>
<li><p>So this look a little odd behavior what apple guys says.</p></li>
<li><p>So can any one help me to find whether i can use this code in my work. and will it be acceptable by Apple store.</p></li>
</ul>

<p>Thanks in advance.</p>
