Microsoft Word - iOSAppReverseEngineering.docx

(Romina) #1

Figure 10- 97 [NSAttributedString string]


Let’s test “instantMessageWithText:flags:” with an NSAttributedString object:


cy# attributedString = [[NSAttributedString alloc] initWithString:@"iOSRE test"]
#"iOSRE test{\n}"
cy# message = [IMMessage instantMessageWithText:attributedString flags:100005]
#"IMMessage[from=(null); msg-subject=(null); account:(null); flags=186a5; subject='<<
Message Not Loggable >>' text='<< Message Not Loggable >>' messageID: 0 GUID:'00A8C645-
D207-4F93- 9739 - 07AAC94E7465' date:'437812476.099226' date-delivered:'0.000000' date-
read:'0.000000' date-played:'0.000000' empty: NO finished: YES sent: YES read: NO
delivered: NO audio: NO played: NO from-me: YES emote: NO dd-results: YES dd-scanned: NO
error: (null)]"
cy# [attributedString release]

An IMMessage object appears, but as you can see, the value of flags is presented in


hexadecimal instead of decimal. Only a tiny fix is needed to make it correct:


cy# message = [IMMessage instantMessageWithText:attributedString flags:1048581]
#"IMMessage[from=(null); msg-subject=(null); account:(null); flags=100005; subject='<<
Message Not Loggable >>' text='<< Message Not Loggable >>' messageID: 0 GUID:'61012DF3-
1C0F-4DED- 9451 - 975E5771D493' date:'447412682.028256' 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)]”

Everything should be ready by now. Last but not least:


cy# [chat sendMessage:message]

The effect is shown in figure 10-98. Let’s call it a day.

Free download pdf