Do I need to free C variables in Objective-C code (iOS 6 with ARC)? -
if implement following within iphone code:
nsstring* soundpath = [[nsbundle mainbundle] pathforresource:soundfile oftype:@"wav"]; systemsoundid feedbacksound; audioservicescreatesystemsoundid((__bridge cfurlref) [nsurl fileurlwithpath:soundpath], &feedbacksound); audioservicesplaysystemsound(feedbacksound); do have free "feedbacksound" c code? leak?
i'm using arc / ios 6.
you should. correct method call is:
audioservicesdisposesystemsoundid (reference).
in general arc deals objective-c objects. when deal lower-level framework (core graphics, audioservices, etc.) many calls allocate memory "under hood" disposal responsible. on many occasions, have specific methods deallocation, have doing allocation.
Comments
Post a Comment