gpt4 book ai didi

ios - MPMusicPlayerController 无法从 Apple Music 播放

转载 作者:行者123 更新时间:2023-12-02 00:33:52 27 4
gpt4 key购买 nike

我尝试播放 Apple Music 中的歌曲,但失败并显示以下日志:

2019-09-26 00:15:57.790999+0200 [1886:463973] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-09-26 00:15:57.791129+0200 [1886:463973] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-09-26 00:15:57.792655+0200 [1886:464074] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-09-26 00:15:57.792770+0200 [1886:464074] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-09-26 00:15:57.794124+0200 [1886:464074] SSAccountStore: Unable to get the local account. error = Error Domain=SSErrorDomain Code=100 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
2019-09-26 00:15:59.670842+0200 [1886:463973] [SDKPlayback] -[MPMusicPlayerController prependQueueDescriptor] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1 "No commands provided." UserInfo={NSDebugDescription=No commands provided.}
2019-09-26 00:15:59.671051+0200 [1886:463973] [SDKPlayback] -[MPMusicPlayerController prepareToPlay] completed id=applicationMusicPlayer error: Error Domain=MPMusicPlayerControllerErrorDomain Code=1 "prepareToPlay without a queue" UserInfo={NSDebugDescription=prepareToPlay without a queue}
2019-09-26 00:15:59.681627+0200 [1886:464074] [MediaRemote] MRC <MPCPlayerPath: route=<MPAVEndpointRoute: 0x282930a80 name=iPhone uid=LOCAL> origin=Nastasia's iPhone-1280262988 bundleID=com.apple.MediaPlayer.RemotePlayerService playerID=MPMusicPlayerApplicationController>: Undo optimistic state [failed] command=Play error=Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1)" UserInfo={NSDebugDescription=Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=1}
2019-09-26 00:15:59.681787+0200 [1886:464074] [SDKPlayback] -[MPMusicPlayerController play] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0" UserInfo={NSDebugDescription=Failed to send command 0, NSUnderlyingError=0x281319230 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1)" UserInfo={NSDebugDescription=Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=1}}}
2019-09-26 00:16:03.596320+0200 [1886:464071] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-09-26 00:16:03.596374+0200 [1886:464071] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-09-26 00:16:03.597965+0200 1886:464051] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-09-26 00:16:03.598079+0200 [1886:464051] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-09-26 00:16:03.599416+0200 [1886:464074] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-09-26 00:16:03.599456+0200 [1886:464074] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-09-26 00:16:03.599542+0200 [1886:464074] SSAccountStore: Unable to get the local account. error = Error Domain=SSErrorDomain Code=100 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}

我还尝试了 Apple 名为 Adding-Content-to-Apple-Music 的官方示例代码项目,并得到了类似的结果:


2019-09-25 23:20:37.268162+0200 [1738:432623] [RemoteControl] userIdentityForMediaRemoteOptions -❗️No user identity data. Using active account.
2019-09-25 23:20:37.333703+0200 [1738:432751] [SDKPlayback] -[MPMusicPlayerController prepareToPlayWithCompletionHandler:] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 122" UserInfo={NSDebugDescription=Failed to send command 122, NSUnderlyingError=0x282eacff0 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 122 (MRMediaRemoteCommandHandlerStatus = 2)" UserInfo={NSDebugDescription=Failed to send command 122 (MRMediaRemoteCommandHandlerStatus = 2), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=2}}}
2019-09-25 23:20:37.333721+0200 [1738:432562] [SDKPlayback] -[MPMusicPlayerController prepareToPlay] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 122" UserInfo={NSDebugDescription=Failed to send command 122, NSUnderlyingError=0x282eacff0 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 122 (MRMediaRemoteCommandHandlerStatus = 2)" UserInfo={NSDebugDescription=Failed to send command 122 (MRMediaRemoteCommandHandlerStatus = 2), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=2}}}
2019-09-25 23:20:37.337138+0200 [1738:432546] [MediaRemote] MRC <MPCPlayerPath: route=<MPAVEndpointRoute: 0x281498a80 name=iPhone uid=LOCAL> origin=Nastasia's iPhone-1280262988 bundleID=com.apple.MediaPlayer.RemotePlayerService playerID=MPMusicPlayerApplicationController>: Undo optimistic state [failed] command=Play error=Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1)" UserInfo={NSDebugDescription=Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=1}
2019-09-25 23:20:37.337529+0200 [1738:432562] [SDKPlayback] -[MPMusicPlayerController play] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0" UserInfo={NSDebugDescription=Failed to send command 0, NSUnderlyingError=0x282ead260 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1)" UserInfo={NSDebugDescription=Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=1}}}
2019-09-25 23:20:37.342424+0200 [1738:432623] [Middleware] INVALIDATE: 0x2813842d0: Invalidated before returning a response. Re-requesting items.
2019-09-25 23:20:38.144321+0200 [1738:432323] [SDKPlayback] Failed validators id=applicationMusicPlayer: {(
play
)}
2019-09-25 23:20:38.944291+0200 [1738:432323] [SDKPlayback] Failed to get a valid response. Resetting expectations id=applicationMusicPlayer

这个问题有时会通过使用应用程序、转到 Apple Music 应用程序、在那里播放某些内容、杀死它、返回等等来随机解决...

如果有人遇到类似问题,请告诉我如何解决。

发生在 iOS 12 和 13、iPhone 6s 和 iPhone 11 上,Apple Music 帐户目前处于 3 个月的试用期。所有音乐功能都存在,能够成功获取开发者 token 和音乐用户 token ,两者都可以很好地处理 Apple Music API 请求。

最佳答案

似乎原因之一可能是我使用 musicPlayerController.prepend() 函数而不是 setQueue()。不幸的是,由于音乐播放器的限制,我被迫使用 prepend()

以下是我的应用程序需要执行的操作的简短描述:

  • 用户开始播放歌曲列表。
  • 在播放过程中,应用程序每 5-10 秒从后端获取新的歌曲列表,并将其设置为新的歌曲队列。这意味着接下来播放的内容是非常动态的。

现在,当涉及到在播放期间设置新队列时,setQueue() 确实不擅长。如果我只调用 setQueue() ,那么什么也不会发生,旧队列将保留。但是,如果我在 setQueue() 之后调用 play()prepareToPlay() ,则当前播放将停止,并且新的第一首歌曲队列将开始播放。这不是我想要的,我需要在“幕后”更改队列,以便当用户在应用程序或 iOS 锁定屏幕中点击“跳到下一首”时,就会播放新歌曲。这就是我使用 prepend() 的原因 - 它工作得很好,当前播放不会中断。另一种选择 - 在 applicationQueuePlayer 上调用 perform() 会崩溃,并显示消息“花费太长时间” - 我想,手动逐项删除 30 首歌曲的旧队列并不是最佳选择。

所以目前我只看到一个选项 - 手动存储一个状态来判断这是否是第一次运行。如果是,则调用setQueue(),否则调用prepend()。也没有办法让当前队列自己检查是否为空。

关于 play() - 它并不像看起来那么简单。正如我上面已经提到的,如果我之前调用过 setQueue(),play() 就会触发新的队列播放。它给我带来了更多问题,因为当我在没有 play() 的情况下调用 setQueue() 时,它没有执行任何操作,但是每次我按下暂停/播放时 - 播放器由于之前的“静音”setQueue(),正在跳到下一首歌曲。我必须实现另一种解决方法,即调用 player.currentPlaybackRate = 1 而不是 player.play(),这看起来不太好。如果所有这些都以某种方式记录下来,那就太好了。

关于ios - MPMusicPlayerController 无法从 Apple Music 播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58107299/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com