MPMusicPlayerApplicationController恰好在30首歌曲后停止在后台播放

时间:2019-11-30 16:57:33

标签: ios mpmusicplayercontroller apple-music

我有一个应用程序可以使用MPMusicPlayerController.applicationQueuePlayer播放 Apple Music 中的歌曲。我一直在连接后端,并使用player.prepend(MPMusicPlayerStoreQueueDescriptor(storeIDs: ids))更新歌曲队列。

为了测试该应用程序,我让它在后台运行了一整夜。早上音乐没有播放,锁定屏幕上没有显示任何音乐控件,我的应用程序也没有运行-好像是停止播放音乐时ios杀死了我的应用程序,因为它在后台不执行任何操作。回到我的应用程序时,播放完全中断,当我尝试播放下一首曲目或再次开始播放时-没有任何效果,我需要终止该应用程序并重新开始。

我做了几次测试,每次大约1.5个小时后,该应用在播放了30首歌曲后便停止播放。有趣的是,我总是使用player.prepend()预先添加30首歌曲,但是调试显示该歌曲队列实际上更大,例如105首左右。当我查看日志时,我会在那1.5个小时内看到来自音乐播放器的所有可能的错误日志和警告,但在这段时间内音乐播放正常。最后一个有趣的日志是TIMEOUT,尽管在这1.5个小时内我收到了4次类似的消息,但是最后一个日志结束了我的应用。

Here是带有时间戳的完整日志,已过滤以仅保留与媒体播放器相关的内容。以下是其中一些:

2019-11-30 04:04:36.175688+0100 MyApp[4278:1630772] [Middleware] TIMEOUT Request: <MPCPlayerRequest: 0x280d0a520 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> timing out.
2019-11-30 04:04:36.221643+0100 MyApp[4278:1630772] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d56ac0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [5.396877s] error: Error Domain=MPRequestErrorDomain Code=2 "(null)"
2019-11-30 04:04:36.227077+0100 MyApp[4278:1630772] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d54240 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.113625s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28318f180 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 04:04:36.229159+0100 MyApp[4278:1630772] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28318f180 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}


OPENING THE APP NEXT DAY ->


2019-11-30 13:01:33.528720+0100 MyApp[4278:1711694] [SDKPlayback] -[MPMusicPlayerController prependQueueDescriptor] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 125" UserInfo={NSDebugDescription=Failed to send command 125, NSUnderlyingError=0x2831bdef0 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 125 (MRSendCommandError = 5)" UserInfo={NSDebugDescription=Failed to send command 125 (MRSendCommandError = 5)}}}
2019-11-30 13:01:33.667624+0100 MyApp[4278:1630937] [] nw_read_request_report [C61] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.668843+0100 MyApp[4278:1630937] [] nw_read_request_report [C30] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.683226+0100 MyApp[4278:1711697] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d337b0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.174930s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x2831784e0 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:33.683451+0100 MyApp[4278:1711694] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x2831784e0 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:33.687983+0100 MyApp[4278:1630937] [] nw_read_request_report [C61] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.701848+0100 MyApp[4278:1630937] [] nw_read_request_report [C30] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.799727+0100 MyApp[4278:1630937] Task <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034> HTTP load failed, 190/0 bytes (error code: -1005 [1:53])
2019-11-30 13:01:33.800991+0100 MyApp[4278:1711694] Task <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x283014a50 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x281c7df90 [0x1d868f5e0]>{length = 16, capacity = 16, bytes = 0x100201bb8fcc65250000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://<mybackend>/updatePlaybackInfo, NSErrorFailingURLKey=https://<mybackend>/updatePlaybackInfo, _kCFStreamErrorDomainKey=1}
2019-11-30 13:01:33.801301+0100 MyApp[4278:1711694] [Error]: The network connection was lost. (Code: 100, Version: 1.17.3)
2019-11-30 13:01:33.801515+0100 MyApp[4278:1711694] [Error]: Network connection failed. Making attempt 1 after sleeping for 1.390448 seconds.
2019-11-30 13:01:33.971848+0100 MyApp[4278:1711694] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d2abe0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.037286s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283050210 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:33.973632+0100 MyApp[4278:1630937] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283050210 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.277935+0100 MyApp[4278:1630937] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d6b060 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.002645s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28302d560 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.278317+0100 MyApp[4278:1711695] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28302d560 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.503560+0100 MyApp[4278:1630937] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d2b180 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.014466s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283051260 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.505085+0100 MyApp[4278:1711695] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283051260 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.873151+0100 MyApp[4278:1711695] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d68c60 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.004019s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283084600 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
...

0 个答案:

没有答案