我在Tweak.xm中有以下代码:
%hook NSString
- (BOOL)isEqualToString:(NSString *) aString {
NSLog(@"%@", [NSString stringWithFormat:@"isEqualToString for : %@ with: %@", aString, self]);
return %orig;
}
%end
然而,syslog输出显示self但不是aString(应该是for :),例如:
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
为什么不输出aString?
答案 0 :(得分:1)
我会猜测字符串是nil
还是空的。在方法的开头检查。即。
if (aString == nil || [aString length] == 0)
{
...
}