简体   繁体   中英

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 :

    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.

Thanks for your help !

您的代码可以由没有手动内存管理的解决方案替换:

 NSArray *itemsArray = [fdEntries subarrayWithRange:itemRange];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM