MOAspects icon indicating copy to clipboard operation
MOAspects copied to clipboard

Crash at stringWithClass

Open Damonvvong opened this issue 7 years ago • 0 comments

I have got a crash at

0   MOAspects                       0x0000000103721824 +[MOARuntime stringWithClass:] + 22564 (MOARuntime.m:43)
1   MOAspects                       0x0000000103723d28 +[MOAspectsStore keyWithClass:selector:methodType:] + 32040 (MOAspectsStore.m:48)
2   MOAspects                       0x0000000103723860 +[MOAspects targetInStoreWithClass:selector:methodType:hookRange:] + 30816 (MOAspects.m:290)
3   MOAspects                       0x0000000103722884 +[MOAspects hookMethodForClass:selector:methodType:aspectsPosition:hookRange:usingBlock:] + 26756 (MOAspects.m:107)
4   MOAspects                       0x00000001037226e0 +[MOAspects hookInstanceMethodForClass:selector:aspectsPosition:hookRange:usingBlock:] + 26336 (MOAspects.m:46)
5   MOAspects                       0x0000000103722548 +[MOAspects(Swift) hookInstanceMethodForClass:selector:position:range:usingParameterBlock0:] + 25928 (MOAspects+Swift.m:28)

here is your code

// MOARuntime.m line 43
+ (NSString *)stringWithClass:(Class)clazz
{
    return [NSString stringWithCString:object_getClassName(clazz)
                              encoding:NSUTF8StringEncoding];
}

here is similar problems

So, Whether to change into the following will be better

+ (NSString *)stringWithClass:(Class)clazz
{
    return NSStringFromClass(clazz);
}

Damonvvong avatar Feb 23 '18 07:02 Damonvvong