我已閱讀關於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會爲您解除分配數據庫路徑。 –