iOS - A new experience in real-device debugging


It’s been a long time since I’ve run an iOS test on a real machine. I helped debug it today and found that a lot of things have changed and some things are unfamiliar. I’ll record them here.


Get the real machine UDID

Creating a Profile requires binding the UDID of the device. How to obtain it?
The search results are varied, but actually using Xcode is enough.
After the phone is connected, click Add Additional Simulatorsto enter the device management page

Insert image description here


Switch to
the Identifier under the Device Tab, which is the UDID.

Insert image description here


Please reconnect the device.

It's not necessarily a data cable issue, but an Xcode version issue.
If this error occurs, you can also see the relevant error information in the above device management interface. like:
Insert image description here

Reference: https://blog.csdn.net/zjpjay/article/details/108770188


iOS developer mode

During the debugging process of some versions of Xcode, the phone needs to be turned on 开发者模式to debug;
turn it on in Settings - Privacy and Security, and after switching to developer mode, the phone needs to be restarted to take effect.

Insert image description here


Fetching debug symbols

Click run. You may need to download some symbols. This process takes about 3 minutes.
After the download is complete, the code will automatically run.
Insert image description here


Library not found for

When pod introduces a third-party library for compilation, Xcode prompts library not found for. Generally, the library cannot be found. The search results will prompt you to look at the search library path;
but students who work on both iOS and macOS can look at the podfile to introduce the third-party library. The target is not iOS.


The file couldn’t be opened. – 修改 objectVersion

Synchronize the project between two computers. If the Xcode versions are different, an error may be reported during runtime:

The file couldn’t be opened

Generally, the objectVersion in the project configuration file causes incompatibility. The processing method is as follows:


Find the project file appname.xcodeproj(not .xcworkspacefile) and display the package content
Insert image description here


Open project.pbxprojthe file (I use VS Code),
Insert image description here


You can see that the objectVersion version was originally 56, but I changed it to 48. Open the project again to run it.
I haven't delved into the specific objectVersion corresponding to each Xcode; if you are not sure which value is appropriate, you can also create a new project using the current Xcode and take a look at the corresponding objectVersion.
Insert image description here


For Pod

Find the project location of the Pod. If you don't know, you can do this in xcode.
Insert image description here


Insert image description here


Open the same project.pbxprojand modify objectVersionthe key


Any iOS Device No simulator available

It also appears in the scenario of synchronizing Xcode projects between two different versions.

Runtime prompt:

A build only device cannot be used to run this target.
Please select an available device or choose a simulated device as the destination.

The simulator displays: Any iOS Device, and cannot be added.
At this time, you can check the Deployment Info
for the code that may have been synchronized before. The selected simulator version is too high; your current Xcode does not support it. Try turning it down a bit.

Insert image description here


Italy 2023-12-24 (Sun)

Guess you like

Origin blog.csdn.net/lovechris00/article/details/135183416