steipete / Aspects

Delightful, simple library for aspect oriented programming in Objective-C and Swift.
https://twitter.com/steipete
MIT License
8.4k stars 1.26k forks source link

fix crash on simulator iphone5s/6s/7 #127

Closed ZenonHuang closed 3 years ago

ZenonHuang commented 7 years ago

When I have some code

- (CGPoint)funcToSwizzleReturnPoint:(CGPoint)point
{
    return CGPointZero;
}

I use Aspects:

    SEL selector =  NSSelectorFromString(@"funcToSwizzleReturnPoint:");
    [Obj aspect_hookSelector:selector withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> info){
        NSLog(@"aspect obj");
    } error:nil];

Run on simulator iphone5s/6s/7, it crash.

So. I try to add code

#if defined(__LP64__) && __LP64__
            if (valueSize == 16) {
                methodReturnsStructValue = NO;
            }
#endif

It work.