Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios 11 array语法糖获取元素 如:array[2], 执行的[__NSArrayI objectAtIndexedSubscript:] #11

Open
GYQ6 opened this issue Nov 13, 2017 · 1 comment

Comments

@GYQ6
Copy link

GYQ6 commented Nov 13, 2017

需要把array的objectAtIndexedSubscript: 也加一个安全判断

@jasenhuang
Copy link
Owner

jasenhuang commented Jun 8, 2018

/* 数组有内容obj类型才是__NSArrayI /
NSArray
obj = [[NSArray alloc] initWithObjects:@0, @1, nil];
[obj swizzleInstanceMethod:@selector(objectAtIndex:) withMethod:@selector(hookObjectAtIndex:)];
[obj swizzleInstanceMethod:@selector(subarrayWithRange:) withMethod:@selector(hookSubarrayWithRange:)];
[obj swizzleInstanceMethod:@selector(objectAtIndexedSubscript:) withMethod:@selector(hookObjectAtIndexedSubscript:)];
[obj release];

@gyg6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants