ios - 如何从 ARC 中的函数返回对象?

标签 ios objective-c cocoa-touch cocoa automatic-ref-counting

如果没有 ARC,我可以对数组使用 autorelease,如下所示

//-(NSMutableArray *)getObjects 

-(NSMutableArray *)retrieveObjects
{
    NSMutableArray *aArray = [[NSMutableArray alloc] init];
   // add objects
   return [aArray autorelease];
}

如何在 ARC 中实现相同的效果?

最佳答案

您不会自动释放该对象。

关于ios - 如何从 ARC 中的函数返回对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17314231/

相关文章:

ios - APNS 静默远程通知未触发 - SWIFT 3

iOS 7's deprecation of NSString' s drawAtPoint :forWidth:withFont:minFontSize:actualFontSize:lineBreakMode:baselineAdjustment:

objective-c - ABRecordSetValue 返回的 CFErrorRef 的内存管理

ios - 切换方向时如何正确定位我的 ScrollView 图像?

swift - 使用动画更改 rootViewController 时 viewWillAppear/DidAppear 被调用两次

ios - 通过 iOS swift 照片框架保存时如何命名照片

ios - Bundle creator 操作系统类型代码 ???在 Xcode 4 中

ios - Cordova AJAX 请求不工作

objective-c - Swift ViewController 与 Objc 中的 TableView 使 Cell 隐藏

cocoa-touch - 实现可变大小的多行表格单元的最佳方法是什么?