Original address: coffee pig _ioser
Mobile development This piece of work is undoubtedly the UI and interaction, and UI debugging is a chore that mobile developers often do. Although the iOS development tool Xcode now integrates the UI debugging functionality (Debug View Hierarchy), it gives us only disappointment. Next, as the title sees, the author briefly introduces and uses reveal, because this thing is not difficult to use, so focus on how to integrate into the project. But... This tool is charged, but fortunately we are in the celestial (you know, brute force). Simple Introduction
The use of reveal is actually very simple, as the first Zhang Zhen the effect of the plot. In the middle is the view of the 3D visualization of the current app page, the UI elements and hierarchies on the left, and the view's properties on the right, you can modify the view color, frame, and so on, and the effect is rendered to the emulator in a timely manner. When you really use it, you can read it at a glance. And about reveal download just go to Google a bit to take care of it. As for the children's shoes without FQ, Baidu on the line.
Integration
There are two ways to integrate reveal into your project. The first is to add reveal framework
to the project (not recommended). The second is to use the LLDB command (Mad Blood vomiting recommended).
Framework integration (not recommended)
And about using the framework
integrated way can refer to I wrote a long time ago on the csdn of an article, point I sent the past. Because the disadvantage of integrating in this way is that you also have to configure Project other linker Flags
, and be careful not to pack it together when you package the release. And each project is going to join the reveal framework and configure it other linker Flags
. So the question is, is there a way to do it once and for all? is to configure an environment, no matter how many projects are directly used? The answer is yes. That's the second way to configure the LLDB, because this requires a bit of lldb of basic knowledge, which is described in this chapter.
LLDB integration (recommended for vomiting)
The advantage of LLDB integration is that there is no need to worry about packing the reveal framework. and locally configured, as long as any project on this machine is generic. The most important point is that the high bigger.
The use is LLDB命令集成
actually very simple, broadly divided into the following two steps.
First step: click
pause program execution
, pause the app. such as
The second step: Enter two commands sequentially, respectively, as follows:
First article:
Expr (Class) nsclassfromstring (@ "ibarevealloader") = = nil? (void *) dlopen ("/applications/reveal.app/contents/sharedsupport/ios-libraries/ Libreveal.dylib"0x2): ((void*)0)
1 ps:/applications/reveal.app/contents/sharedsupport/ios-libraries/ Libreveal.dylib This address is the absolute path, my Reveal is stored in the application directory, so the path is/applications/reveal.app/.....
Article II
Expr (void) [(nsnotificationcenter*) [Nsnotificationcenter Defaultcenter] Postnotificationname:@ " Ibarevealrequeststart " object: nil];
Two if the command is successful, the console will print
INFO: Reveal Server started (Protocol Version 25).
This message. such as
PS: If the output is not correct at last
INFO: Reveal Server started
, then you should check the Dlopen in the first command to see if the path contained in the message is correct.
Finally, you click on the continue
button or continue to enter the characters in the console c
, then return to the end of the program to pause.
Now, you're opening your Reveal
, click in the top left corner, and see No Connection
If you have your app. Next, you will enjoy the pleasure that reveal brings to you ...
Setting aliases in. lldbinit
But it's not over, Nikki. Each time you need to reveal to review the UI, enter these two commands that look so sore. Isn't that what I want? So ... Fortunately, we can ~/
add aliases to our commands .lldbinit
in the files in the directory LLDB
.
First of all, simple science. .lldbinit
is a hidden file, seemingly the default is not. Xcode
each time you start, you will go to ~/.lldbinit
this directory to find the commands in this file LLDB
. So we can do some initialization of the command in this file or set the alias and so on (this article does not do this introduction).
Now, we open the terminal and enter touch ~/.lldbinit
the command in the terminal to create it. Then enter open ~/.lldbinit
the command. The file is opened in a text editor. You can then copy the following characters into a text editor:
1 command alias Bd_reveal_sim expr (Class) nsclassfromstring (@ "ibarevealloader") = = Nil? (void *) Dlopen (/ Applications/reveal.app/contents/sharedsupport/ios-libraries/libreveal.dylib0x2): ((void*) 02 command alias Bd_reveal_start expr (void) [(nsnotificationcenter*) [ Nsnotificationcenter Defaultcenter] Postnotificationname:@ " ibarevealrequeststart Object:nil];
Command alias is in the format: command alias alias Lldb commands, so as above Bd_reveal_start and Bd_reveal_sim is the alias I set. You can also replace your favorite names.
Crack
Since reveal is charged, we have to use some means. There are measures under the so-called policy. In fact, it is very simple, directly to the ~/Library/Preferences/com.ittybittyapps.Reveal.plist
path of this file to kill, and then restart the computer. But this is not a complete break, but a 30-day trial cycle. After 30 days of trial, after the file to kill, and then restart the computer. Of course ~/Library/Preferences/
There are more files in this directory, now you open your terminal, and then enter rm ~/Library/Preferences/com.ittybittyapps.Reveal.plist
This command can be deleted. Then go ahead and restart your computer. This hack method is simple and rough and practical.
UI debugging Artifact for ios:reveal use and hack