[英]Implicit conversion of a non-Objective-C pointer type 'void *' to '__unsafe_unretained id *' is disallowed with ARC
I'm trying to migrate to ARC but I get this error, i really don't know how to resolve this one : 我正在尝试迁移到ARC,但出现此错误,我真的不知道该如何解决:
NSArray *itemsArray = nil;
__unsafe_unretained id *objArray = calloc (itemRange.length, sizeof (id)); //got the error here
[fdEntries getObjects:objArray range:itemRange]; //fdEntries is an NSMutableArray
itemsArray = [NSArray arrayWithObjects:objArray count:itemRange.length];
free(objArray);
Here is the error: Automatic Reference Counting Issue: Implicit conversion of a non-Objective-C pointer type 'void *' to '__unsafe_unretained id *' is disallowed with ARC. 以下是错误:自动引用计数问题:ARC不允许将非Objective-C指针类型'void *'隐式转换为'__unsafe_unretained id *'。
Thanks for your help ! 谢谢你的帮助 !
您的代码可以由没有手动内存管理的解决方案替换:
NSArray *itemsArray = [fdEntries subarrayWithRange:itemRange];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.