确定第三方应用程序正在iPhone上播放的歌曲 [英] Determine song being played on iPhone by third-party app

查看:56
本文介绍了确定第三方应用程序正在iPhone上播放的歌曲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定当前在iPhone上播放的歌曲的标题.我知道我可以使用以下代码来查找本地Apple应用程序正在播放音乐时正在播放的音乐,但是如果从Spotify或其他音乐播放应用程序中播放歌曲,如何查找歌曲的标题?

I am trying to determine the title of the song currently being played on an iPhone. I know I can use the following code to find out what is playing if the native Apple app is playing the music but how do I find the title of a song if its being played from Spotify or some other music playing app?

MPMediaItem *nowPlayingItem = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];
NSString *itemTitle = [nowPlayingItem valueForProperty:MPMediaItemPropertyTitle];

推荐答案

如果在其他应用程序中播放歌曲,您将无法获得歌曲标题!

No you can't get title of song if its playing in some other app!

编辑1-

您不能这样做,因为Apple的政策非常严格,每个应用程序都在自己的小沙箱中运行,该沙箱无法访问任何其他应用程序数据.

You can't do that because Apple has a very strict policy that runs every app in its own little sandbox that cannot access any other applications data.

-谢谢Emil ...

-- Thanks Emil ...

这篇关于确定第三方应用程序正在iPhone上播放的歌曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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