簡體   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

我正在嘗試遷移到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);

以下是錯誤:自動引用計數問題:ARC不允許將非Objective-C指針類型'void *'隱式轉換為'__unsafe_unretained id *'。

謝謝你的幫助 !

您的代碼可以由沒有手動內存管理的解決方案替換:

 NSArray *itemsArray = [fdEntries subarrayWithRange:itemRange];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM