问题
I was using AVPlayer to play online mp3 stream ! When I pause the player
[AVPlayer pause];
AVAudioSession *session = [AVAudioSession sharedInstance];
session.delegate = nil;
NSError *error = nil;
[session setActive:NO error:&error];
NSLog([error description]);
I met the error , Error Domain=NSOSStatusErrorDomain Code=560030580 "The operation couldn’t be completed. (OSStatus error 560030580.)"
Can anyone tell me why and how to resolve it?
Thank you very much!!
回答1:
I encounter this problem too. I googled and see this post more than one time. From the forum, someone said, the error code can be figured out by AVAudioSession.h.
In my case, the problem seems to be race condition problem. It never happens on my iPhone 5s, but happens on other devices generally, ex: iPhone6 Plus.
As far as I know, the error code 560030580 means AVAudioSessionErrorCodeIsBusy.
From AVAudioSession.h, the following is defined.
typedef NS_ENUM(NSInteger, AVAudioSessionErrorCode)
{
AVAudioSessionErrorCodeNone = 0,
AVAudioSessionErrorCodeMediaServicesFailed = 'msrv', /* 0x6D737276, 1836282486 */
AVAudioSessionErrorCodeIsBusy = '!act', /* 0x21616374, 560030580 */
AVAudioSessionErrorCodeIncompatibleCategory = '!cat', /* 0x21636174, 560161140 */
AVAudioSessionErrorCodeCannotInterruptOthers = '!int', /* 0x21696E74, 560557684 */
AVAudioSessionErrorCodeMissingEntitlement = 'ent?', /* 0x656E743F, 1701737535 */
AVAudioSessionErrorCodeSiriIsRecording = 'siri', /* 0x73697269, 1936290409 */
AVAudioSessionErrorCodeCannotStartPlaying = '!pla', /* 0x21706C61, 561015905 */
AVAudioSessionErrorCodeCannotStartRecording = '!rec', /* 0x21726563, 561145187 */
AVAudioSessionErrorCodeBadParam = -50,
AVAudioSessionErrorInsufficientPriority = '!pri', /* 0x21707269, 561017449 */
AVAudioSessionErrorCodeResourceNotAvailable = '!res', /* 0x21726573, 561145203 */
AVAudioSessionErrorCodeUnspecified = 'what' /* 0x77686174, 2003329396 */
} NS_AVAILABLE_IOS(7_0);
回答2:
For me, this was the answer: Disconnect from Airplay.
来源:https://stackoverflow.com/questions/16439767/error-domain-nsosstatuserrordomain-code-560030580-the-operation-couldn-t-be-com