我在我的应用程序中使用 ARC 并因此出现新的崩溃:
malloc: *** error for object 0x17e9a5d0: double free
*** set a breakpoint in malloc_error_break to debug
为了弄清楚,我启用了 Zombie Objects ,原因是:
*** -[CFString release]: message sent to deallocated instance 0x15d183e0
我的代码:
Class myClass = NSClassFromString(classString);
SEL mySelector = NSSelectorFromString(selectorString);
NSString *arg = @"arg";
NSMethodSignature *sig = [myClass methodSignatureForSelector:mySelector];
NSInvocation * myInvocation = [NSInvocation invocationWithMethodSignature:sig];
[myInvocation setTarget: myClass];
[myInvocation setSelector: mySelector];
[myInvocation setArgument:&arg atIndex:2];
NSString *result = nil;
[myInvocation retainArguments];
[myInvocation invoke];
[myInvocation getReturnValue: &result];
NSLog(@" Result String : %@ ",result);
出了什么问题?哪个 CFString ?? 感谢您的任何回复。
编辑:
造成的对象NSString *result
。下一步如何纠正这个错误?