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?
This happens at times while using Xcode 9.
There are multiple solution to this as mentioned below :
Note : Make sure that your device is not locked when Xcode is trying to install app.
Solution 1 :
i. Disconnect device
and connect again
Solution 2 :
i. Restart you device
Solution 3 :
i. Disconnect device
ii. Quit Xcode
(Shortcut key : cmd + Q)
iii. Open your project
iv. Clean project
(Shortcut key : cmd + shift + K
)
v. Now connect device
vi. Run
your project
For me Solution 3 worked perfectly
I had to re-add device to xcode.
In XCode open Devices and Simulators (CMD+Shift+2), in left list press + button and re-add the same device.
All the previous solutions didn't work.
Finlay, changing the iPhone's cable solved the problem.
The fastest way for now i found is:
1) Go to Window -> devices (changed the hotkey in xcode to CMD+P for me)
2) Press unpair on the device.
3) Press trust in iPhone.
4) Build again or Run without building (Ctrl+CMD+R)
A simple solution:
First, unplug your device.
Now, unlock your device and plug it in again. Be sure that the device is unlocked.
Now run the Xcode project by selecting the device as target.
I have a very simple solution which worked for me instantly. Takes some 10 sec to do:
1) Go to Window -> Devices & Simulators
and untick Show as run destination
2) Unplug the cable and plug it back in.
3) Run the project.
This should be solving your problem!