检测设备上的iTunes播放列表文件夹 [英] Detecting iTunes playlist folders on a device

查看:165
本文介绍了检测设备上的iTunes播放列表文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过iTunes,您可以创建任意嵌套的播放列表文件夹。当您将这些播放列表文件夹复制到iOS设备时,iTunes可以检测到它们是文件夹,并允许您深入到最终获得歌曲的位置。知道他们是怎么做的吗?我一直试图解决这个问题几天。

Through iTunes, you can create playlist folders that are nested arbitrarily deep. When you copy those playlist folders to your iOS device, iTunes is able to detect that they're folders, and allows you to drill down to the point where you ultimately get songs. Any idea how they do that?? I've been trying to figure this out for days.

当我查询已知文件夹的特定持久ID时,我能看到的唯一不同的东西是不同的来自包含歌曲的播放列表:

When I query for a specific persistentID of a known folder, the only things I can see about it that are different from a playlist that contains songs are:


  • playlist.mediaTypes = 4359(这是
    音乐|播客|有声读物|电影| VideoiTunes)而正常的播放列表
    不会混合音频类型和视频类型

  • 属性
    的值MPMediaPlaylistPropertyPlaylistAttributes包含2
    (MPMediaPlaylistAttributeSmart),而正常播放列表包含0

  • 项目数量将等于
    设备上的项目总数

但是,就是这样!我没有看到任何方法来获取子文件夹。或者,当询问文件夹中包含的播放列表或子文件夹时,我看不到任何方法将其绑定到父文件夹。

But, that's it! I don't see any way to get at the sub-folders. Or, when interrogating a playlist or subfolder that's contained within a folder, I don't see any way to tie it to the parent.

Apple在iTunes中这样做,所以一定有办法。他们是否使用了一些私有API?

Apple does it in iTunes, so there must be a way. Are they using some private API?

推荐答案

有以下未记录的属性可以使用<$找到你想要的东西 MPMediaPlaylist valueForProperty 方法: @isFolder,和 @parentPersistentID

There are the following undocumented properties that can get you what you are looking for using MPMediaPlaylist's valueForProperty method: @"isFolder", and @"parentPersistentID".

注意,这些没有记录,也没有出现在任何头文件中,所以使用根据Apple的应用程序提交规则,它们可能被视为使用私有API。

Note, these are not documented and do not appear in any header files, so use of them might be considered use of a 'private API' according to Apple's application submission rules.

我已经向Apple打开了一个错误报告,要求在标题中提供这些报告文件,并要求澄清它们是否被视为私有API的一部分。

I've opened a bug report to Apple asking that those be made available in header files, and also asking to clarify whether they are considered to be part of a private API.

这篇关于检测设备上的iTunes播放列表文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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