I'm trying to run an app on a device for a very long duration (in hours). I thought that Xcode would keep running the app, but it exited several times, saying "Finished running on my iPhone."

I'm using a MacBook Pro, so I thought the computer had just gone to sleep (which it had), but now that I'm on adapter power (plugged in, charged to 98%), it just did the same thing and stopped running the app with the same termination message. I need the app to keep running for hours to complete my test. The app will also not be in the foreground the entire time, other apps may be in the foreground as a critical component of these operations.

How can I make Xcode continue to run my app under test until I tell it to terminate?

Note: Xcode did not crash, and there was no indication the mac lost stability. I'm running the latest version as of this writing, Xcode 9.3, on macOS 10.13.4; this is a fresh install of the OS and Xcode (less than a week old), with all security updates applied, and only Xcode and Firefox installed. Xcode and Firefox are both running, with neither showing stability issues.

  • You mentioned that your Mac had gone to sleep. Have you observed it happening every time?
    – Nimesh Neema
    Apr 13, 2018 at 2:35
  • No, at first I thought it was just the Mac going to sleep, but then I observed it happen even when on AC power and with an incredibly long sleep delay. Apr 13, 2018 at 5:29

1 Answer 1


I would submit the app to TestFlight so you aren’t running in a constrained fashion. I know no way to circumvent this timeout but hopefully someone else will edit this post or answer if there is a better way (by hook or by crook if necessary).

  • I'm not sure this actually answers the question - how will TestFlight help me keep the app running on the test device, attached to my development computer, until I instruct the application to terminate? Apr 13, 2018 at 15:12
  • It will turn the app in to a stand alone app that runs longer. The timeout is inherent in your workflow of using Xcode to drop the app on the device. It's a nice way of saying you won't be happy if you need Xcode builds to run for hours or days.
    – bmike
    Apr 13, 2018 at 16:35
  • Aha, that makes sense! However, I'm specifically using xcode to send specific location (GPS) data to the app. Would converting the app to a standalone specifically disable/disallow me from doing that GPS designation? Apr 13, 2018 at 19:28
  • That would be a great question for stack overflow. Just show your code (or a snipped of what API you are calling) and ask away there : - ) You'll probably need to add some location entitlements, but maybe it'll run. No harm in just submitting a build to Apple - they'll tell you what needs to be fixed as well.
    – bmike
    Apr 13, 2018 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .