Skip to content

Support hooking app frameworks #72

Open
@haniag

Description

@haniag

Feature Request

Is your feature request related to a problem? Please describe.
When I run the application, only code within it can be swizzled. The code within the frameworks used by the application can't be swizzled/accessed.

Describe the solution you'd like
I used this code to load all frameworks on iOS using dlopen to hook app frameworks, and it can be adapted to MacForge:

NSString *pfpath = [[NSBundle mainBundle] privateFrameworksPath];
for (NSString *dir in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:pfpath error:NULL]) {
        NSMutableString *fpath = [pfpath mutableCopy];
        NSArray *components = [dir componentsSeparatedByString:@"."];
        NSString *fname = components[0];
        [fpath appendFormat:@"/%@/%@", dir, fname];

        if ([fpath rangeOfString:@"swift"].location == NSNotFound) {
            dlopen([fpath UTF8String], RTLD_NOW);
        }
    }

Describe alternatives you've considered
None.

Teachability, Documentation, Adoption, Migration Strategy
N/A

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions