Is there a way that I could put my iPhone lock code into Xcode, so I wouldn't need to unlock my iPhone for every build?

It gets really frustrating that I need to physically unlock my iPhone before every build.

I know for developing on android they allow you to put the device in dev mode, which restricts the device from sleeping.


Could everyone please report this as a bug?

As it stands, you either put up with it, or much worse, turn off locking. Neither option is good.

If the iOS device is in developer mode, and connected to an active Xcode instance, Xcode should be able to keep the phone unlocked.

That way you not only can leave locking on, but it will re-lock the instant you disconnect.

  • 1
    Why would this be a bug? It's simply designed by intention. You would want someone to be able to download any app they want on your phone the chance it's stolen & "returned" as is. Clearly a security feature. Your making it sound as if turning the phone to never auto locking is such an arduous task. There are multiple options to circumvent this 'problem' however Apple can't plan for user end laziness. & yes I am a developer and very active on SO – soulshined Apr 19 '16 at 12:57
  • You first state that autolock is a good feature, and then say how easy it is to turn off. Those statements disagree with each other. Turning off autolock is generally a bad idea, but necessary during development. A feature that does this automatically while plugged into Xcode is a very good idea, preventing people from accidentally disabling the feature you say is good. – Maury Markowitz Apr 19 '16 at 13:34
  • Your misinterpreting my words to suit your arguments. I never said good feature. Said security feature. And I never said easy to turn off. Stated u were exaggerating procedures to do so. Regardless, Im not a 5 year old, and dont want to treat u as one either. Im just stating my opinion & perspective. Its all about your development preferences. If u make it a habit to turn off auto lock and then make it a habit to turn it on once done it will become second nature. I just feel u over exaggerated the situation & solutions. I wouldnt call it a bug, my main argument, just a feature request. Cheers – soulshined Apr 19 '16 at 13:50

You can prevent the device from sleeping in Settings → General → Auto-Lock → Never. This means the device will stay unlocked and you won't need to unlock it. As I'm jailbroken, I have this set automatically when my device is connected to a computer with Xcode running, but changing this setting manually will also work fine.

Alternatively, you can set Settings → Passcode → Require Passcode to a longer interval so that your passcode isn't required if you need to unlock it. Don't forget to reset this setting back to its original setting after you finish developing.

  • It seems auto-lock -> never is no longer an option in ios 9. – puzzl Oct 1 '15 at 18:36

As far as I know this is not possible. The only possible solution, obviously, would be to disable the iPhone's passcode during your programming sessions.


The real answer is you currently need to jailbreak to do this as @grgarside alluded to.

Use Activator (install from Cydia if you don't already have it), and set the action for Anywhere -> Connected (Power) to the action that disables the Auto-Lock. Do the opposite (enable Auto-Lock) for Disconnected (Power).

  • 1
    We shouldn't have to jailbreak to do this. Please, go to the Apple Bug Reporter and report it. If enough of us do so, they'll fix this. – Maury Markowitz Apr 28 '15 at 16:49

In Xcode 7.3 it seems that you only have to unlock your device on the first build. After that, your device stays unlocked until you unplug it or exit the app you're testing.

You must log in to answer this question.

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