1
votes

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 !

1
What are you trying to do - are you trying to not use alloc for an array of objects?deanWombourne

1 Answers

2
votes

Your code can be replaced by a solution without manual memory management:

 NSArray *itemsArray = [fdEntries subarrayWithRange:itemRange];