I have the following code in Tweak.xm:
%hook NSString
- (BOOL)isEqualToString:(NSString *) aString {
NSLog(@"%@", [NSString stringWithFormat:@"isEqualToString for : %@ with: %@", aString, self]);
return %orig;
}
%end
However the syslog output shows self but not aString (should be after for :), example:
Apr 9 20:46:32 remini CitrixReceiver-iPad[7972] <Warning>: isEqualToString for : with: /var/mobile/Containers/Data/Application/42123BED-A507-4CE0-97B0-20DFFD9BB78C
Apr 9 20:46:32 remini CitrixReceiver-iPad[7972] <Warning>: isEqualToString for : with: /Applications/Cydia.app
Apr 9 20:46:32 remini CitrixReceiver-iPad[7972] <Warning>: isEqualToString for : with: /private/var/lib/apt/
Apr 9 20:46:32 remini CitrixReceiver-iPad[7972] <Warning>: isEqualToString for : with: /var/mobile/Containers/Data/Application/42123BED-A507-4CE0-97B0-20DFFD9BB78C
Why is aString not outputted?
I would hazard a guess that the string is either nil
or empty. Check against that at the beginning of the method. i.e.
if (aString == nil || [aString length] == 0)
{
...
}