objective c blocks - Do I have to use release for memory management in iOS programming? -


i saw following piece of code

 uialertview *alert = [[uialertview alloc] initwithtitle :@”hello world!” message:@”iphone, here come!” delegate :self cancelbuttontitle:@”ok” otherbuttontitles:nil ]; [alert show]; [alert release]; 

do need call release every time, or there way automatically manage memory garbage collection in java or .net?

you can use arc (automatic reference counting), not garbage collection kind of compiler functionality let developers not worrying memory management.

check out question , link

in brief arc manual reference counting (mrc) compiler figuring out when call retain/release.

you can convert non -arc project use arc xcode (edit->refactor->convert objective-c arc). can selectively set projects/files not use arc (e.g. third party code).


Comments