访问 iPhone 播放数据
我希望能够提取用户最近播放的 50 首歌曲,然后能够通过艺术家/专辑/流派等对其进行排序。我如何才能在应用程序打开时立即实现这一点以及最好的方法是什么(我我正在考虑字典?)将其捆绑起来以便我可以将其发送到服务器?
谢谢!
I want to be able to pull out the user's 50 most recently played songs, then be able to sort that via artist/album/genre etc. How can I make this happen immediately upon the app's opening and what would be the best way (I'm thinking dictionary?) to bundle this up so I can send it to a server?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MPMediaItemPropertyLastPlayedDate 可能就是您要找的。请参阅此相关问题 了解如何访问各种媒体项目属性。
您的应用程序委托的
applicationDidBecomeActive:
方法将是启动时扫描的合适位置,并且转换为 JSON 的 NSDictionary 应该是合适的序列化格式。但是,请务必在将数据发送到您的服务器之前通知用户。
MPMediaItemPropertyLastPlayedDate might be what you're looking for. See this related question for how to access the various media item properties.
Your app delegate's
applicationDidBecomeActive:
method would be an appropriate place to scan on-launch, and an NSDictionary converted to JSON should be suitable serialization format.Be sure to inform the user before sending their data off to your server, however.