简体   繁体   English

ARC不允许将非Objective-C指针类型'void *'隐式转换为'__unsafe_unretained id *'

[英]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.

相关问题 ARC不允许将非Object-C指针类型void *隐式转换为NSString * __ strong * - Implicit conversion of a non-Objective-C pointer type void* to NSString*__strong* is disallowed with ARC ARC不允许将非目标C指针类型'int *'隐式转换为'Bird *' - Implicit conversion of a non-Objective-C pointer type 'int *' to 'Bird *' is disallowed with ARC ARC 不允许将 Objective-C 指针隐式转换为“void *” - implicit conversion of an Objective-C pointer to 'void *' is disallowed with ARC ARC 不允许目标 c 类型指针“CFDataRef”的隐式转换? - implicit conversion of objective c type pointer 'CFDataRef' is disallowed with ARC? TPMultiLayoutViewController的ARC转换; ARC不允许将Objective-C指针隐式转换为“ const void *” - ARC conversion of TPMultiLayoutViewController; Implicit conversion of an Objective-C pointer to 'const void *' is disallowed with ARC ARC和__unsafe_unretained - ARC and __unsafe_unretained ARC禁止将非目标C指针类型'const UInt8 *'(aka'const unsigned char *')强制转换为'NSData *' - Cast of a non-Objective-C pointer type 'const UInt8 *' (aka 'const unsigned char *') to 'NSData *' is disallowed with ARC 将'__unsafe_unretained id *'强制转换为'const void **' - Casting '__unsafe_unretained id *' to 'const void **' 使用ARC-sqlite3不允许将Objective-C指针隐式转换为'void *' - implicit conversion of an Objective-C pointer to 'void *' is disallowed with ARC - sqlite3 ARC不允许将Objective-C指针隐式转换为'const char *'? - Implicit conversion of an Objective-C pointer to 'const char *' is disallowed with ARC?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM