Xcode “Device Locked” When iPhone is unlocked

前端 未结 30 2060
失恋的感觉
失恋的感觉 2021-01-29 18:53

When I tried to build and run, Xcode said my device was locked. I looked at my iPhone, and it\'s not locked at all. How do I fix this?

相关标签:
30条回答
  • 2021-01-29 19:30

    Recently I have met the Xcode shows "development cannot be enabled while your device is locked, Please unlock your device and reattach. (0xE80000E2).

    If your iOS device is already unlocked and connected to mac and still get the error from Xcode 8.1 after upgrading to iOS 10.1.1, then the mac is not trusted by the device.

    To fix it, first disconnect device to mac and then go to iOS settings app, and open general->reset->Reset Location & Privacy.

    Then connect device to mac and when prompted, set select trust the mac.

    Then wait the processing symbol files within your device and mac. After it finished, you can run the project to your device. It will be working.

    0 讨论(0)
  • 2021-01-29 19:31

    For anyone who need a logical answer..

    1. Go to Window -> Devices & Simulators. Right click on your device & unpair it.
    2. Disconnect from cable & reconnect.
    3. Wait for it & let Xcode detect you device.
    4. Run the project.
    5. Make sure you TRUST on your iOS device and enter any passcode.
    0 讨论(0)
  • 2021-01-29 19:33

    Did you by chance not "trust" the device? This will prevent it from communicating with xcode even if the device is unlocked.

    Update here's a support doc from Apple: http://support.apple.com/en-us/HT5868

    0 讨论(0)
  • 2021-01-29 19:34

    I recently ran into this issue with XCode 8 just after updating my device from iOS 9 to 10. The exact error I received was:Development cannot be enabled while your device is locked. Please unlock your device and reattach. I received this error even when my phone was unlocked, and after unplugging and re-plugging in the device.

    As is mentioned in several answers, the device is locked message is actually referring to the device not trusting the MacBook. In my case, I think my phone defaulted to not trusting my computer after updating to iOS 10. Here are the steps that worked for me to reset the settings (this is the same process that is mentioned in the Apple support page in tehprofessors' answer):

    1. Disconnect your device from your MacBook and close Xcode.
    2. On your device go to Settings > General > Reset, then tap Reset Location & Privacy
    3. Plug your device back into your computer, and on the device you will be prompted to trust the computer. Tap trust.
    4. Now reopen Xcode and rebuild the project.
    5. The device locked error should disappear.
    0 讨论(0)
  • 2021-01-29 19:34

    These steps worked for me in iOS 10.

    1. Remove the cable from device.
    2. Plug in the device.
    3. Clean and build the Xcode project.
    0 讨论(0)
  • I run into this problem quite often (at least like 5 times a week). Almost every time this happens, a Xcode restart fixes it. But this time nothing seemed to work including:

    • Restarting Xcode;
    • Unplugging and re-plugging the iPhone;
    • Cleaning the project (cmd+shift+k);
    • Cleaning derived data (cmd+option+shift+k)

    Done dozens of times in all sorts of different orders.

    What fixed the issue for me this time was simply:

    ✅ Rebooting the Mac.

    0 讨论(0)
提交回复
热议问题