Debugging Tips for iOS Development

About this article:

1. Shortcut keys for the emulator

2, cover installation precautions

3. Add photos to the simulator album

4. The data of the program in the simulator

5. Install an older version of the emulator

6. Simulate slow network speed

7. Exception breakpoints and symbolic breakpoints


 

1. Shortcut keys for the emulator

Commonly used emulator shortcut keys:

Cmd + 1/2/3 toggles the display scale of the emulator. ( The simulator after Xcode9.0 can be scaled freely)

Opt + Shift brings up the two-finger drag effect in the simulation.

Opt can call up the pinch zoom effect on the emulator.

Cmd + Shift + H Home keyboard for the emulator. (The simulator after Xcode 9.0 can display the Home button, volume button, and power button, you can directly use the mouse to click the corresponding position)

Cmd + Left/Right can switch between landscape and portrait.

Regarding the shortcut key, it is still the same sentence. First of all, it is important to know that this function is available. If you don’t know it, Baidu will be fine.

 

2, cover installation precautions

When debugging the application on the simulator or real machine, if you overwrite the installation (without deleting the application), when developing the project, the newly deleted data files will not be deleted immediately on the simulator or real machine . If there are strict requirements for this piece, then you need to delete the application first and debug the application.

 

3. Add photos to the simulator album

There are roughly two types of channels:

First, drag the picture from Finder to the simulator, the simulator will be opened with Safari, and then because Safari has the function of long-pressing to save to the album .

The second is to do it through the simulator itself. But in the end, the "Save to System Album" function was used. Well, you can use Safari to find pictures online. You can also make an iOS software and put it on the simulator to achieve the same responsibility as Safari. This software is equivalent to a medium.

 

4. The data of the program in the simulator

The path is relatively long, like the following.

There is nothing to remember, run the use of the emulator, print it

NSLog(@"%@",NSHomeDirectory());

can be found.

Sometimes when you are working on a project, you need to check the content of Shahe frequently, so make a stand-in for the corresponding Shahe folder and put it on the desktop for easy viewing. A specific Shahe folder is determined by three branches: a specific system + a specific device + a specific application.

A real machine without jailbreak can't get the Shahe of the application.

 

5. Install an older version of the emulator

One of the settings of Xcode is "Components", and you can download the corresponding version directly in it. I can still download the iOS8.1 simulator on Xcode.

Of course, you can also get a matching simulator by downloading an older version of Xcode.

 

6. Simulate slow network speed

On the emulator, you can simulate slow network speed through the vase software.

On a real machine, you can use the relevant settings provided by Apple for developers to listen to. The specific location is in "Settings" - "Developer" - "Status" - "Network Link Conditioner". If you can't find this option in your phone's settings, you can try connecting your phone to your computer and using Xcode's Originizer to set it up as a test device.

 

7. Exception breakpoints and symbolic breakpoints

Breakpoints are often used during development and debugging. There are many ways to use breakpoints, such as editing symbolic breakpoints.

In the breakpoint management interface,

Add Exception Breakpoint-----The exception breakpoint can be paused before the program exits due to an abnormal crash, so that we can locate the wrong place.

Add Symbolic Breakpoint-----Symbolic breakpoint can add a breakpoint to the specified method for easy tracking.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325003667&siteId=291194637