2

When doing a class-dump on Instagram (v7.7), I am confused on why in this class, the method declaration for "sponsoredContext" is missing. In comparison, IDA shows the "-(char)sponsoredContext" method.

Class Dump result:

@interface IGFeedItemTimelineLayoutAttributes : XXUnknownSuperclass {
    BOOL _sponsoredContext;
    BOOL _showExploreContext;
    BOOL _showTimeStampOnFirstLayoutElement;
    IGFeedItem* _feedItem;
    NSArray* _rowItems;
}
@property(retain, nonatomic) NSArray* rowItems;
@property(assign, nonatomic) BOOL showTimeStampOnFirstLayoutElement;
@property(assign, nonatomic) BOOL showExploreContext;
@property(assign, nonatomic) BOOL sponsoredContext;
@property(retain, nonatomic) IGFeedItem* feedItem;
-(void).cxx_destruct;
-(id)commentForTextTimelineRow:(int)textTimelineRow;
-(int)cellTypeForTextTimelineRow:(int)textTimelineRow;
-(int)numberOfTextRowsInTimeline;
-(id)initWithFeedItem:(id)feedItem sponsoredContext:(BOOL)context showExploreContext:(BOOL)context3 showTimeStampOnFirstLayoutElement:(BOOL)element;
@end

IDA result:

IGFeedItemTimelineLayoutAttributes - (char)sponsoredContext
char __cdecl -[IGFeedItemTimelineLayoutAttributes sponsoredContext](struct IGFeedItemTimelineLayoutAttributes *self, SEL)
__IGFeedItemTimelineLayoutAttributes_sponsoredContext_

MOV             R1, #(_OBJC_IVAR_$_IGFeedItemTimelineLayoutAttributes._sponsoredContext - 0x15C64)
ADD             R1, PC
LDR             R1, [R1]
LDRSB           R0, [R0,R1]
BX              LR
End of function -[IGFeedItemTimelineLayoutAttributes sponsoredContext]

Also, when I try to hook this method using Logos:

%hook IGFeedItemTimelineLayoutAttributes
-(BOOL)sponsoredContext{
    NSLog(@"Text:%d", %orig());
    return %orig();
}
%end

Cydia Substrate gives me the error:

MS:Warning: message not found [IGFeedItemTimelineLayoutAttributes sponsoredContext:]

How can I hook this method? Why doesn't class-dump show it, but IDA does? What's special about this method?

Thanks in advance.

abuhun
  • 43
  • 5
  • 2
    I assume that class-dump is not showing the method with selector `sponsoredContext` because it is a getter for the property `sponsoredContext`. I don't know anything about Logos, but that error message looks like it's trying to hook a selector called `sponsoredContext:` (note the extra colon at the end), which doesn't exist. – John Calsbeek Oct 22 '15 at 13:45
  • Properties in ObjC are just a syntactic sugar and some compiler magic. `@property(assign, nonatomic) BOOL sponsoredContext` is compiled into auto-generated getter `-(BOOL)sponsoredContext` and setter `-(void)sponsoredContext:(BOOL)value` methods. Class-dump just makes it easier to read, it could and in earlier versions did output getter and setter methods explicitly. – creker Oct 22 '15 at 16:27

0 Answers0