Microsoft Word - iOSAppReverseEngineering.docx

(Romina) #1
cy# [#0x146e1af0 subviews]
@[#"<UIScrollView: 0x146bfa90; frame = (0 0; 320 568); gestureRecognizers = <NSArray:
0x146e1e90>; layer = <CALayer: 0x146c8740>; contentOffset: {0, 0}; contentSize: {320,
77.5}>",#"<_TabGradientView: 0x146e7010; frame = (- 320 - 508; 960 568); alpha = 0;
userInteractionEnabled = NO; layer = <CAGradientLayer: 0x146e7d80>>",#"<UIView:
0x146e29c0; frame = (-10000 568; 10320 10000); layer = <CALayer: 0x146e2a30>>"]
cy# [#0x146e29c0 superview]
#"<MFTiltedTabView: 0x146e1af0; frame = (0 0; 320 568); userInteractionEnabled = NO;
gestureRecognizers = <NSArray: 0x146f2dd0>; layer = <CALayer: 0x146e1d50>>"

The above code can get subviews and superviews. In a word, we can get any view objects


that are visible on UI by combining the above methods, which lays the foundation for our next


steps.


In order to locate “compose” button, we need to find out the corresponding control object.


To accomplish this, the regular approach is to examine control objects one by one. For views


like <UIView: viewAddress; ...>, we call [#viewAddress setHidden:YES] for everyone of them,


and the disappeared control object is the matching one. Of course, some tricks could accelerate


the examination; because on the left side of this button there’re two lines of sentences, we can


infer that the button shares the same superview with this two sentences; if we can find out the


superview, the rest of work is only examining subviews of this superview, hence reduce our


work burden. Commonly, texts will be printed in description, so we can directly search “3


Unsent Messages” in recursiveDescription:


| | | | | | | | <MailStatusUpdateView: 0x146e6060; frame = (0 0;
182 44); opaque = NO; autoresize = W+H; layer = <CALayer: 0x146c8840>>
| | | | | | | | | <UILabel: 0x14609610; frame = (40 21.5; 102
13.5); text = ‘3 Unsent Messages’; opaque = NO; userInteractionEnabled = NO; layer =
<_UILabelLayer: 0x146097f0>>

Thereby, we get its superview, i.e. MailStatusUpdateView. If the button is a subview of


MailStatusUpdateView, then when we call [MailStatusUpdateView setHidden:YES], the button


would disappear. Let’s try it out:


cy# [#0x146e6060 setHidden:YES]

However, only the sentences are hidden, the button remains visible, as shown in figure 6-12:

Free download pdf