Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thanks to the comment above, and the failure of all my other ideas, I went ahead and took advantage of <strong>ARC</strong>.</p> <p>I didn't want to refactor my entire project to start using <strong>ARC</strong>, so I rewrote a new class to handle all of my audio needs and set some compiler flags (<strong>-fobjc-arc</strong>) to enable <strong>ARC</strong> just for that file.</p> <p>Not exactly sure what I was doing wrong before, but the system seems to be much better at managing memory than I am, and I'm happy to let it solve all my problems.</p> <p><strong>EDIT 2</strong>:</p> <p>Apparently Apple did finally fix their memory leak so I went back to my <strong>ARC</strong> solution which works fine for both <strong>iOS 5</strong> and <strong>iOS 6</strong>.</p> <p><strong>EDIT</strong>:</p> <p>I may have been a little premature.</p> <p>While implementing <strong>ARC</strong> for this was helpful in general, this specific problem goes deeper.</p> <p>Apparently, there is a leak in <strong>Core Foundation</strong> for <strong>iOS 6</strong>.</p> <p><a href="https://stackoverflow.com/questions/12498015/leak-from-nsurl-and-avaudioplayer-using-arc">Leak from NSURL and AVAudioPlayer using ARC</a></p> <p><a href="https://stackoverflow.com/questions/13309745/memory-leak-nsstring-nsurl">Memory Leak - NSString &amp; NSURL</a></p> <p>Using <strong>ARC</strong>, it works fine on my <strong>Gen 3 iOS 5</strong> device, but leaks significantly for <strong>Gen 4/5 iOS 6</strong>.</p> <p>Without <strong>ARC</strong>, <strong>Gen 4/5 iOS 6</strong> works fine, but <strong>Gen 3 iOS 5</strong> crashes.</p> <p>I ended up making two versions of my new class, one using <strong>ARC</strong> and one not, and checking the system version at runtime <strong>[[UIDevice currentDevice] systemVersion]</strong> to determine which version to use.</p> <p>It may be a little clumsy, but does allow me to support the <strong>Gen 3</strong> devices. If <strong>Apple</strong> ever fixes their problem I can return to a single version at that time.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload