iOS:保存在iTunes Library中可见的音频文件 [英] iOS: Saving audio file visible in iTunes Library

查看:72
本文介绍了iOS:保存在iTunes Library中可见的音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将mp3文件保存到一个文件夹中,该文件在iTunes Library中可见.我在某处读到,如果将其保存在NSDocumentDirectory上,它将可以工作,但是我没有运气尝试过.

I am trying to save a mp3 file into a folder where the file could be visible in iTunes Library. I read somewhere that if I save it on NSDocumentDirectory, it would work, but I had no luck on trying that.

我还尝试了NSMusicDirectory和NSLibraryDirectory.

I also tried NSMusicDirectory and NSLibraryDirectory.

这是我的保存方式:

NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDirectory = [documentPath objectAtIndex:0];
NSString *savePath = [docDirectory stringByAppendingPathComponent:@"file.mp3"];
[_oneNSDataFile writeToFile:savePath atomically:YES];

感谢您的宝贵时间!

推荐答案

对不起,坏消息:) iOS中的iPod Library Access API不允许第三方应用程序修改用户音乐库的内容.除此之外,将媒体文件添加到库目录中将不起作用,因为该库使用(二进制)索引文件来确定库的内容以及媒体资产的位置.

Sorry, bad news :) The iPod Library Access API in iOS doesn't allow third party apps to modify the contents of the user's music library. In addition to that, adding a media file into the library directory won't work, because the library uses a (binary) index file to determine the contents of the library, and the locations of the media assets.

这篇关于iOS:保存在iTunes Library中可见的音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆