天天看點

iOS程式設計過程中出錯:’autorelease’ is unavailable iOS程式設計過程中出錯:’autorelease’ is unavailable: not available in automatic reference counting mode, ARC forbids explicit message send of ‘autorelease’

iOS程式設計過程中出錯:’autorelease’ is unavailable: not available in automatic reference counting mode, ARC forbids explicit message send of ‘autorelease’

如: return [[[NSString alloc] initWithData:encryptData encoding:NSUTF8StringEncoding] autorelease]; 隻需把autorelease改為init即可 1.其實錯誤很明顯,就是說,autorelease不能使用,原因在于我們之前建立目前iOS程式的時候,選擇了“Use Automatic Reference Counting”,即使用了ARC,自動引用計數,是以此處,在寫代碼的時候,就不允許你再手動添加autorelease這個關鍵字了。 對應的,編譯器會幫你自己優化生成對應的釋放記憶體的操作。