问题
After installing an iOS application to a device using Xcode, for testing on the device, how long will the app continue to function after the device is disconnected?
回答1:
From personal testing, if I deploy the application using the Run command in Xcode, and then remove the USB cable, generally this terminates the application on the device within a few seconds. This is because you've run the application in debug mode. In debug mode, the application's connected to your debugger in Xcode; debug mode outputs log statements to the connected debugger. This also ties the execution of the application to the debugger (so it can catch fatal exceptions and other things). If you unplug the cable, the application will terminate very quickly as a result of being unable to communicate with Xcode.
If you deploy the application, but then hit Stop after all of the build phases have completed (and before or even after the application runs), you should be able to use the application separately from Xcode, and it will work for as long as the device has power, and the provisioning profile you used to deploy it has not expired.
If you're deploying a test version, you're likely using a Development Provisioning Profile (as opposed to Distribution). These last twelve months from the time you generate them on the iOS Provisioning Portal.
Distribution provisioning profiles last a shorter amount of time. One I currently have expires in September, and I believe I generated it in December last year, so that's about 9 months.
回答2:
On another note:
As for how long you can use your own "installed app" on your device without being connected to Xcode; I have noticed recently (as of Dec 2018 - Jan 2019), that you can use your app on your device (iPhone for me), for about a week or so. Once this proposed "time-frame" is over, the app will not open and the "Device Management" information is gone from your device. ei:( -> General -> Device Management -> approve you as a developer)
Not sure if this is true for anyone else, but has constantly been happening to me. I would like to know if any of you have experienced the same situation.
Hope this helps-
来源:https://stackoverflow.com/questions/9289078/how-long-will-an-ios-app-continue-to-function-after-being-installed-for-testing