Convert caf file to m4r programmatically on ios4
Is there a way to convert a .caf file to a .m4r (ringtone) file programmatically on the iPhone? I've tried a bunch of stuff and nothing seems to work. Importing into garageband and then sharing a开发者_C百科s ringtone works but I want to do it in my app.
AVFoundation and its class AVAssetExportSession
https://developer.apple.com/documentation/avfoundation/avassetexportsession
To use the above class, you have to create a AVAsset (or one of its inherited classes) and supply that to exportAsynchronouslyWithCompletionHandler: for instance. I recently found out that even though exportAsynchronouslyWithCompletionHandler: is supported from iOS 4.0, it seems that you really need iOS 4.1 because exportAsynchronouslyWithCompletionHandler: in turn uses the 4.1 exportSessionWithAsset:presetName:
精彩评论