我已阅读关于ARC的概念以及我们如何使用@property
来定义strong
或weak
引用。我的问题是如何做一个定义或者当他们都在里面方法的空闲指针和我想的范围结束这样的存储器,可尽快回收,因为这ARC内部方法创建指针
- (void) SomeMethod {
NSString* databasePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent: @"contacts.db"]];
....
....
}
我的问题是我怎么释放字符串databasePath
?
看看这里:https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html#//apple_ref/doc/uid/20000994-BAJHFBGH TL;您不必为此烦心,ARC会为您解除分配数据库路径。 –