==> CaveatsAdd the following line to ~/.lldbinit to load chisel when Xcode launches: command script import /usr/local/opt/chisel/libexec/fblldb.py
做好上面的步骤,然后重启Xcode就可以尝试下了。
如果安装成功的话,那么你就会看到如下图的这些命令。
img
这里大概会有30个命令吧,我记得我第一次装的时候没那么多命令的,facebook又更新了很多。其实这些封装的命令,就是使用python封装了一下函数然后调用。凡是这些封装的命令,你都可以通过多个lldb命令打出来,所以如果你会使用python的话,那么你可以根据自己的使用习惯封装一些常用的lldb命令。我使用了也有一段时间的chisel了,但是感觉并不是所有的命令都很常用,而且有写使用的场景也不是很清楚,所以在这里给大家普及一下,如果有谬误,请大家及时指正。(ps:和大家说个快捷键,cmd+k快速清楚console的信息。) 一般我们使用chisel的命令的时候,我们可以通过 help + chisel命令,譬如 help + pvc,得到如何具体使用这个命令,但是有时候你看了help信息也不一定就会用呢。
============================================================== vs Interactively search for a view by walking the hierarchy. 在该层搜索指定的view, 参数为view的地址 vs 0x7fb22b52f420 Arguments: ; Type: UIView*; The view to border.
Syntax: vs
============================================================== help visualize Open a UIImage, CGImageRef, UIView, or CALayer in Preview.app on your Mac.
Arguments: ; Type: (id); The object to visualize.
Syntax: visualize
help unslowanim Turn off slow animations.
Syntax: unslowanim
============================================================== help unmask Remove mask from a view or layer
Arguments: ; Type: UIView/CALayer *; The view/layer to mask.
============================================================== help unborder Removes border around .
Arguments: ; Type: UIView/NSView/CALayer *; The view/layer to unborder.
Syntax: unborder
============================================================== Log tapped view to the console.
Syntax: taplog
============================================================== help slowanim Slows down animations. Works on the iOS Simulator and a device.
============================================================== help show Show a view or layer.
Arguments: ; Type: UIView/NSView/CALayer *; The view/layer to show.
Syntax: show
============================================================== help pviews Print the recursion description of . 递归打印描述 从window开始打印 Arguments: ; Type: UIView/NSView; The view to print the description of.
Options: --up/-u ; Print only the hierarchy directly above the view, up to its window. --depth/-d ; Type: int; Print only to a given depth. 0 indicates infinite depth.
Syntax: pviews [--up] [--depth=depth]
============================================================== help ptv Print the highest table view in the hierarchy.
Syntax: ptv
============================================================== help pkp Print out the value of the key path expression using -valueForKeyPath:
Arguments: ; Type: NSString *; The keypath to print
Syntax: pkp
============================================================== help pjson Print JSON representation of NSDictionary or NSArray object
Arguments: ; Type: id; The NSDictionary or NSArray object to print
Options: --plain/-p ; Plain JSON
Syntax: pjson [--plain]
============================================================== help pivar Print the value of an object's named instance variable.
Arguments: ; Type: id; Object expression to be evaluated. ; Type: ; Name of instance variable to print.
Syntax: pivar
============================================================== help pinternals Show the internals of an object by dereferencing it as a pointer. 显示一个对象的内部属性 Arguments: ; Type: id; Object expression to be evaluated.
Syntax: pinternals
============================================================== help pdocspath Print application's 'Documents' directory path.
Options: --open/-o ; open in Finder
Syntax: pdocspath [--open]
============================================================== help pdata Print the contents of NSData object as string. Supported encodings:
ascii,
utf8,
utf16, unicode,
utf16l (Little endian),
utf16b (Big endian),
utf32,
utf32l (Little endian),
utf32b (Big endian),
latin1, iso88591 (88591),
latin2, iso88592 (88592),
cp1251 (1251),
cp1252 (1252),
cp1253 (1253),
cp1254 (1254),
cp1250 (1250),
Arguments: ; Type: NSData *; NSData object.
Options: --encoding/-e ; Type: string; Used encoding (default utf-8).
Syntax: pdata [--encoding=encoding]
============================================================== help pcurl Print the NSURLRequest (HTTP) as curl command.
Arguments: ; Type: NSURLRequest/NSMutableURLRequest; The request to convert to the curl command.
Options: --embed-data/-e ; Embed request data as base64.
Syntax: pcurl [--embed-data]
============================================================== help pclass Print the inheritance starting from an instance of any class.
============================================================== help pcells Print the visible cells of the highest table view in the hierarchy.
Syntax: pcells
============================================================== help pca Print layer tree from the perspective of the render server.
Syntax: pca
============================================================== help panim Prints if the code is currently execution with a UIView animation block.
Syntax: panim
============================================================== help paltrace Print the Auto Layout trace for the given view. Defaults to the key window. 打印所给view的布局 Arguments: ; Type: UIView *; The view to print the Auto Layout trace for.
Syntax: paltrace
============================================================== help pactions Print the actions and targets of a control. 打印指定继承UIControl 的action方法
Arguments: ; Type: UIControl *; The control to inspect the actions of.
Syntax: pactions
============================================================== help mask Add a transparent rectangle to the window to reveal a possibly obscured or hidden view or layer's bounds
Arguments: ; Type: UIView/NSView/CALayer *; The view/layer to mask.
Options: --color/-c ; Type: string; A color name such as 'red', 'green', 'magenta', etc. --alpha/-a ; Type: CGFloat; Desired alpha of mask.
Syntax: mask [--color=color] [--alpha=alpha]
============================================================== help hide Hide a view or layer.
Arguments: ; Type: UIView/NSView/CALayer *; The view/layer to hide.
Syntax: hide
help fvc Find the view controllers whose class names match classNameRegex and puts the address of first on the clipboard.
Options: --name/-n ; Type: string; The view-controller-class regex to search the view controller hierarchy for. --view/-v ; Type: UIView; This function will print the View Controller that owns this view.
Syntax: fvc [--name=classNameRegex] [--view=view]
help fv Find the views whose class names match classNameRegex and puts the address of first on the clipboard.
Arguments: ; Type: string; The view-class regex to search the view hierarchy for.
Syntax: fv fv UIButton
============================================================== help flicker Quickly show and hide a view to quickly help visualize where it is.
Arguments: ; Type: UIView/NSView*; The view to flicker.
Syntax: flicker
============================================================== help fa11y Find the views whose accessibility labels match labelRegex and puts the address of the first result on the clipboard.
Arguments: ; Type: string; The accessibility label regex to search the view hierarchy for.
Syntax: fa11y
============================================================== help dcomponents Set debugging options for components.
Options: --set/-s ; Set debug mode for components --unset/-u ; Unset debug mode for components
Syntax: dcomponents [--set] [--unset]
============================================================== help caflush Force Core Animation to flush. This will 'repaint' the UI but also may mess with ongoing animations.
Syntax: caflush
============================================================== help border Draws a border around . Color and width can be optionally provided.
Arguments: ; Type: UIView/NSView/CALayer *; The view/layer to border. NSViews must be layer-backed.
Options: --color/-c ; Type: string; A color name such as 'red', 'green', 'magenta', etc. --width/-w ; Type: CGFloat; Desired width of border.
Syntax: border [--color=color] [--width=width]
============================================================== help bmessage Set a breakpoint for a selector on a class, even if the class itself doesn't override that selector. It walks the hierarchy until it finds a class that does implement the selector and sets a conditional breakpoint there.
Arguments: ; Type: string; Expression to set a breakpoint on, e.g. "-[MyView setFrame:]", "+[MyView awesomeClassMethod]" or "-[0xabcd1234 setFrame:]"
Syntax: bmessage
============================================================== help binside Set a breakpoint for a relative address within the framework/library that's currently running. This does the work of finding the offset for the framework/library and sliding your address accordingly.
Arguments:
; Type: string; Address within the currently running framework to set a breakpoint on.
Syntax: binside
============================================================== help alamunborder Removes the border around views with an ambiguous layout
Syntax: alamunborder
============================================================== help alamborder Put a border around views with an ambiguous layout
Options: --color/-c ; Type: string; A color name such as 'red', 'green', 'magenta', etc. --width/-w ; Type: CGFloat; Desired width of border.
Create the Google Play Account
Having a Google account, pay 25$, then you get your google developer account.
References:
http://developer.android.com/distribute/googleplay/start.html
https://p