ARC and CFRelease?

前端 未结 3 2111
天涯浪人
天涯浪人 2020-12-24 12:08

I\'m slightly confused. Everywhere I\'ve read, suggest that when using ARC, you still need to release core foundation objects which makes sense, ARC doesn\'t manage them. Ho

3条回答
  •  难免孤独
    2020-12-24 12:23

    In generally speaking, I think you should try to comment the first CFRelease(mimeType) line, and uncomment the followed two lines: CFRelease(uti) and CFRelease(extension). You cast a toll-free bridge to input NSString and ARC will handle the release. But the uti and extension is created/copied as CFString. ARC will not know how to handle them (remember ARC is a compiler feature for NSObject), so you need to CF release them.

提交回复
热议问题