Xcode “Device Locked” When iPhone is unlocked

前端 未结 30 2372
失恋的感觉
失恋的感觉 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: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.

提交回复
热议问题