Skip to content

Instantly share code, notes, and snippets.

@lint
Created June 26, 2020 01:21
Show Gist options
  • Save lint/1a44809950af828808f75f55e733c63c to your computer and use it in GitHub Desktop.
Save lint/1a44809950af828808f75f55e733c63c to your computer and use it in GitHub Desktop.
*Easier* access of swift ivars with FLEXing
%hook NSObject
%new
- (id)getIvar:(NSString *)arg1 {
id obj;
@try {
const char *str = [arg1 UTF8String];
obj = MSHookIvar<id>(self, str);
}
@catch (NSException *exc) {
obj = nil;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:exc.name message: exc.reason delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
@finally {
return obj;
}
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment