NSObjectSafe crash for iOS8
Closed this issue · 0 comments
jasenhuang commented
for iOS9
[[NSArray alloc] init] --> __NSArray0
for iOS8 and lower
[[NSArray alloc] init] --> __NArrayI
so for iOS8 and lower, we don't need to swizzle for two times:
'''
/* 数组有内容obj类型才是__NSArrayI /
NSArray obj = [[NSArray alloc] initWithObjects:@0, nil];
[obj swizzleInstanceMethod:@selector(objectAtIndex:) withMethod:@selector(hookObjectAtIndex:)];
/* 没内容类型是__NSArray0 */
obj = [[NSArray alloc] init];
[obj swizzleInstanceMethod:@selector(objectAtIndex:) withMethod:@selector(hookObjectAtIndex0:)];
'''