Microsoft Word - iOSAppReverseEngineering.docx

(Romina) #1

Figure 10- 96 IMMessage.h


There’re lots of class methods, among which “instantMessageWithText:flags:” gets our


attention. Seems it returns an IMMessage object, but what’re the 2 arguments? The 1st may be


an NSString object, what about “flag”? I don’t know if you still remember that earlier in this


section, when we were locating [IMChat sendMessage:IMMessage], we’ve “po”ed an


IMMessage object in LLDB:


(lldb) po $r2
IMMessage[from=(null); msg-subject=(null); account:(null); flags=100005; subject='<<
Message Not Loggable >>' text='<< Message Not Loggable >>' messageID: 0 GUID:'966C2CD6-
3710 - 4D0F-BCEF-BCFEE8E60FE9' date:'437730968.559627' date-delivered:'0.000000' date-
read:'0.000000' date-played:'0.000000' empty: NO finished: YES sent: NO read: NO
delivered: NO audio: NO played: NO from-me: YES emote: NO dd-results: NO dd-scanned: YES
error: (null)]

Although the “text” is “not loggable”, the “flag” is 100005. Let’s try it out in Cycript:


cy# [IMMessage instantMessageWithText:@"iOSRE test" flags:100005]


  • [__NSCFString string]: unrecognized selector sent to instance 0x1468c140


Cycript reminds us that NSString failed to respond to @selector(string). In other words, the


1st argument is not an NSString object, but instead some class that can respond to


@selector(string). Let’s try to get some clues in figure 10-96, do you see “NSAttributedString


*_text” in line 17? According to the official documents, NSAttributedString does have a property


named “string”, whose getter is “- (NSString *)string”, as shown in figure 10-97.

Free download pdf