Killing and restarting an application

Hi everyone,
I have an iPod application that i need to kill from within itself.
I would ideally like to restart the application once it dies, but i am pretty sure that cannot be done, but if someone has the info, please let me know.
thanks
tony

Hi Tony -
I assume you know that, in Apple's view, you're planning just about the worst UI mistake possible. The prime directive is to give the user a sense of control, and to always use standard controls the way the user expects. The only acceptable way for an app to terminate is when the user hits the Home button.
These SO articles pretty much cover the topic:
[Proper way to exit iPhone application?|http://stackoverflow.com/questions/355168/proper-way-to-exit-iphon e-application]
[force application to terminate in iPhone|http://stackoverflow.com/questions/1841824/force-application-to-terminat e-in-iphone]
Of the suggestions included at the above links, I think this might be the cleanest:
- (void)terminateMe {
UIApplication *application = [UIApplication sharedApplication];
MyAppDelegate *app_delegate = [application delegate];
[app_delegate applicationWillTerminate:application];
exit(0);
For iOS 4, set the UIApplicationExitsOnSuspend key in Info.plist (see [Screw Multitasking: How To Make Your iOS 4 Apps Exit For Real|http://maniacdev.com/2010/07/screw-multi-tasking-how-to-make-your-ios-4-ap ps-exit-for-real>.
As to restarting the app, I guess you might consider a companion, helper app. Register the URL's of both apps, then start the helper app with [openURL:|http://developer.apple.com/iphone/library/documentation/UIKit/Referen ce/UIApplicationClass/Reference/Reference.html#//appleref/occ/instm/UIApplication/openURL:]. The helper app would then restart the main app.
Note all of the above is an attempt to answer your explicit question regardless of how ill advised your objective might seem. Whatever it is you're trying to accomplish, I suspect there's a much more reasonable way to do it, and would strongly advise you to look for such an alternative. If you need help with that, a new thread with a more descriptive title might be best
- Ray

Similar Messages

  • I cant open Photos om my mac. Just upgraded to Yosemite. The message I get is: An unexpected error has occurred. Please quit and restart the application. I have done this several times but nothing seems to work. iPhoto is gone. What do I do?

    I just upgraded to Yosemite on my mac from 2010. Everything seems to work, accept Photos. When I try to open it i push the "Get started" button, then the picture with "Preparing Library" comes up. Then a message appears with the text "An unexpected error has occurred. Please quit and restart the application." I have done this several times, but nothing happens. What do I do?

    I just upgraded to Yosemite on my mac from 2010. Everything seems to work, accept Photos. When I try to open it i push the "Get started" button, then the picture with "Preparing Library" comes up. Then a message appears with the text "An unexpected error has occurred. Please quit and restart the application." I have done this several times, but nothing happens. What do I do?

  • Automatic force quit and restart locked application after time delay?

    Does anyone know of a shareware/freeware application that will watch for locked/unresponsive applications and force quit and restart that application after a certain time delay?
    Thanks in advance.

    Startup - Gray Screen
    Startup - Gray, Blue or White screen at boot, w/spinner/progress bar
    Startup Issues - Resolve
    Startup Issues - Resolve (2)

  • Constantly have to kill and restart EM agents

    Hello,
    I am currently running EM GC version 10.2.0.4 on an AIX platform. I seem to be encountering frequent issues with various agents within our environment, in that I am constantly having to kill -9 the emagent process on various hosts and then having to restart the agent on these hosts afterwards. There seems to be no pattern in which hosts have to be dealt with in this manner as I am performing this process on different hosts each time the problem occurs. The agent is marked as unreachable in the GC console and then when I go to the host and perform an ./emctl status agent command, the result is that the agent is not running. When I attempt to start the agent using the ./emctl start agent command, nothing happens. I have to kill -9 the running emagent processes and restart the agent again using the ./emctl start agent command. This command is successful, however, it seems that in a week or so, I have to perform this action again on the same host or different host.
    I was wondering if anyone else has experienced this issue after upgrading to version 10.2.0.4 of GC? These problems did not seem to appear nearly as often with version 10.2.0.3. Any assistance in troubleshooting this problem would be greatly appreciated.
    Thanks,
    Scott Kiskis

    I also have similar issue, but i am running 10.2.0.3 GC and 10.2.0.3 agent. The agent processes keep running but get email from GC that the number of targets failed to upload. At least I see a pattern in my place: I receive a high cpu usage message for several hours, before the agent goes into this state.
    emctl status agent shows it is down, but when i try to start, it fails as the emagent process is still running. I have to do kill -9 <pid> and then restart the agent. The agent works fine until I receive the high cpu usage message/email again. It seems to be operating system specific and I am trying to work with my sysadmins to figure out if anything is different in this server compared to others.

  • Can anyone help me with a script to pause and restart an application?

    I am setting up a Mini to control a Canon still camera, using Canons EOS utility app to shoot at a certain interval. However I would like to pause the action during the night. In my dreams I also would like to read the countdown of the EOS app to remotely start a timer that starts and stops a spinning glass (rain deflector), via USB?
    I realize that these are two different tasks, but are they possible?
    To break it down:
    1. At a certain time (8pm) to pause the application, so the result is that the camera stops shooting.
    At 7am the action is to resume.
    I would rather not quit the applications since I would loose my settings, interval and camera settings
    2. The EOS app is counting down towards the next shot. The action I would like is that 1 min, prior to the end of countdown a pulse is given (via USB?) to the relay controlling the rain deflector.
    That relay runs it for 2 mins and then powers down.
    I have this set up analog now, with 2 relays and it works fine, however it would be nice to be able to remotely change the interval setting of the camera and the rain deflector would follow suit.
    Any input would be greatly appreciated.

    I can help you for the future.  Regularly back up your computer to an external hard drive (or cloud alternative).  If you have your library backed up, it could be reinstalled on your new computer.  In your current situation, you will have to reload all of your CDs as syncing of non-iTunes purchased music is only one way (Computer to iPod)

  • I have downloaded Disney HD tv to my sons ipod touch, but when he goes to watch it on his ipod we get the following error "Please check your connection and restart the application" or cannot connect to server". How can I fix this?

    I have downloaded Disney HD tv shows to my son ipod touch, but when he goes to to watch it we get the following error message " or "cannot connect to the server" How can we fix this?  Thank you

    You have to enter the Apple ID and password. You are running into the Activation Lock
    iCloud: Find My iPhone Activation Lock in iOS 7
    Is there a way to find my Apple ID Name if I can't remember it?
    Yes. Visit My Apple ID and click Find your Apple ID. See Finding your Apple ID if you'd like more information.
    How do I change or recover a forgotten Apple ID Password?
    If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.

  • TS1702 The download of updates was interrpted and now it is blocked. How can I kill and restart theprocess?

    The download of four app updates was suddenly interrupted. No way to get it started again. What should I do?

    Try a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release. The screen will go blank and then power ON again in the normal way.] It is app and data safe!

  • Using cron to stop and restart password protected instance (App Server 7)

    I have been asked by a customer to create a cron job to stop and restart their web application running under Applications server 7.
    I have created the script and can stop the instance, but I am unable to start it as it is asking for a password.
    I have included this in the script but it doesn't seem to like having a password supplied this way.
    Am I doing something wrong or Are there any alternative ways of stopping and restarting an application, using Cron?

    Have you looked at using password.conf file as described in --
    http://docs.sun.com/source/816-7155-10/crcfgfil.html#1075615
    You might also want to look at --
    http://docs.sun.com/source/816-7156-10/agsvrprf.html#1019453

  • Troubleshoting help needed:  My iMac keeps crashing and restarting with a report detail: "spinlock application timed out"  What can I do to fix this?timed out"

    Troubleshooting help needed:  My iMac keeps crashing and restarting with a notice: "Spinlock application timed out"  What can I do?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the page that opens.
    Select the most recent panic log under System Diagnostic Reports. Post the contents — the text, please, not a screenshot. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header and body of the report, if it’s present (it may not be.) Please don't post shutdownStall, spin, or hang reports.

  • How do I restore my iPhoto. When I open i get a window dialog "Your iphoto library is either in use by another application or has become unreadable shut down and restart your computer. If problem persists, try rebuilding your iphoto library. To do th

    When I try to open iPhoto I get a window dialog that says...
    Your photo library is either in use by another application or has become unreadable
    Shut down and restart your computer, and then open iPhoto again. If the problem persists, try rebuilding your photo library. To do this, quit iPhoto, and then reopen it while keeping the Option and Command keys pressed. You can also try restoring your photo library from a backup.
    I have tried the reopen it while keeping the Option and Command keyes pressed.
    No change.
    I dee nothing but a blank page,
    Any help would be appreciated.
    Also hace back ups of all images on cd's. dvds and jump drives.
    Any advice is appreciated.

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • Can a subVI tell when the application it is part of has been stopped and restarted?

    Can a subVI tell when the application it is part of has been stopped and restarted?
    It is easy enough for a subVI to tell when it has been run for the first time after having been loaded into memory. But is there a way for a subVI to tell when the application it is part of has been stopped and restarted? Is there some property or application-invocation-specific refnum that when queried multiple times during the same run of the application would return the same value yet when queried during different runs of the application would return different values?
    I don�t want to depend on anything that happens when a run is exited.
    I don�t want to require code to be included in the main V
    I to accomplish the solution.
    (Otherwise I could, in the main VI create an un-named semaphore tied to a global; the subVI could then check the global to see if the value changed, which it would between runs of the application.)
    Any ideas?

    Have you tried the First Call? function? It's on the Advanced>Synchronization palette.

  • To run an application on iAS6sp1 on HP-Unix, while starting the kjs from command line, it gives a GDS error and crashes. Subsequently, after stopping all services and restarting iAS wouldnot come up.

     

    Hi,
    Not a problem, please post the KJS error logs for me to hunt the
    exact reason for the error.
    Thanks & Regards
    Raj
    Neel John wrote:
    To run an application on iAS6sp1 on HP-Unix, while starting the kjs
    from command line, it gives a GDS error and crashes. Subsequently,
    after stopping all services and restarting iAS wouldnot come up.
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • I am unable to use my external CD player. I am told that the player is being used by another application, and that is not true. I have quit everything and restarted. I've unplugged the unit. I have a fairly new mac mini 10.8. What can I do?

    I am unable to use my external CD player. I have a fairly new mac mini 10.8. I am told that the player is being used by another application, but it's not true. I've forced everything to quit and restarted. I've even unplugged the unit and let it rest. I've turned off and unplugged the mac too. I cannot make a CD. Why?

    I misread your message. I thought it said I did not have burn support with the Samsung hardware.
    When the CD goes in it says You inserted a bland CD. choose an action from the popup menu or click ignore
    open finder
    open itunes
    open disk utility
    make this action the default
    eject         ignore           ok
    However, when I am making CDs. I am in itunes. That is where my recordings areI haven't tried to do it from this vantage point.
    I don't know how to make a screen shot on a mac.
    I go to my playlist and click on the little gear icon at the bottom left and I leave things as they are - preferred speed - maximum. I leave it on audio CD - and then I select BURN.
    When I tried this the other day, I could not get it to burn, no matter how hard I tried - everything I could think of, using a different CD, force quitting everything I was not using, restarting the computer, unplugging the CD hardware and plugging it back in after a little while, nothing worked. I got that message that said my player was being used by another application every time I tried to make the CD.  This took over an hour. I don't know of another way to make a CD on the mac; I was not using another program or application. Now it seems to be working fine. I am burning another copy of something I gave away.
    I wish I knew what caused this. It was a real problem Saturday morning.

  • 1st-I was able to log into my account but was not able to open any applications, tried another account and same thing.  was able to log out and restart but now am unable to use mouse.  g5 dual core

    1st-I was able to log into my account but was not able to open any applications, tried another account and same thing.  was able to log out and restart but now am unable to use mouse.  g5 dual core, can't remember the os without seeing it.

    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu. (In Mac OS X 10.4 or later, you must select your language first.)
    Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair. Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)
    Let us know how far you get, or results.

  • I have Lightroom 4.2 which isn't opening in Windows 7. A message comes up saying it's already open in another application. I've tried shutting down and restarting; still not opening.

    I have Lightroom 4.2 which isn't opening in Windows 7. A message comes up saying it's already open in another application; I can't see that it is. I've been using this successfully for 2 years now! I've tried shutting down and restarting; still not opening.

    Found it and deleted!! Success! Thank you!
    On Fri, Dec 12, 2014 at 2:12 PM, Mary Dennis <[email protected]>

Maybe you are looking for