This is the first time I’ve tried to run an Xcode app on my iPhone. To do this, the iPhone must have “Developer Mode” enabled but this settings was not visible on my iPhone. I searched the blog and did not find a suitable solution. Eventually, I got it working so wanted to publish my findings. I am documenting this after trying many things so I am not 100% sure of the magic formula, but “I think” this is what is needed.
PROBLEM
iPhone -> Settings -> Privacy & Security -> Developer Mode (NOT VISIBLE)
ENVIRONMENT
iPhone 12 Pro Max running IOS 16.2
MacBook Pro running macOS 12.5.1
Xcode 14.2
CONNECT IPHONE TO MAC (via USB cable)
CHECK DEVICE STATUS (in Xcode)
Select menu Window -> Devices and Simulators
You should see your iPhone but it will show warnings/issues. (e.g. device not in Developer Mode)
ADD APPLE ID (in Xcode)
Open your app project in Xcode
Select menu Xcode -> Preferences
Select Accounts tab
Add your Apple ID (It will be listed as a “Personal Team”)
SELECT IPHONE AS DESTINATION (in Xcode)
Select menu Product -> Destination -> Choose Destination
In the “IOS Device” section, select your iPhone as the destination
(NOTE: After doing this, the “Developer Mode” setting was available on my iPhone)
iPhone -> Settings -> Privacy & Security -> Developer Mode (Now visible)
SELECT DEVELOPER MODE (on iPhone)
Settings -> Privacy & Security -> Developer Mode (ENABLE)
SELECT APPLE ID AS TEAM (in Xcode)
Select your project in the Project Navigator
Select the project in the TARGETS section
Select “Signing & Capabilities” tab
In the “Signing” section, select the Team as your Apple ID (you previously entered)
After this, I had an error and need to modify the “Bundle Identifier” to make it unique. I just added some numbers to the end and it worked.
CHECK. DEVICE STATUS (in Xcode)
Select menu Window -> Devices and Simulators
This time, your iPhone should appear without any warnings/issues.
LOAD APP ONTO IPHONE (in Xcode)
Hit the arrow in Xcode to Start the active scheme. (The App will be loaded onto your iPhone.)
RUN APP (on iPhone)
Try running the app and the iPhone will not allow it since you have not authorized apps from this developer.
Goto Settings -> General -> VPN & Device Management
Authorize your Apple ID to run apps on this phone.
You should now be able to run the app without issue.