Sometimes you get error code -12780, and it's completely undocumented ( rdar://20194243 - please document this stupid code plzkthx).
Thanks to Dave DeLong: Its a CoreMedia error: Returned when caller passes incorrect input or output parameters
So it's a paramErr, but for CoreMedia. Something, somewhere, internally went amiss, and it's interpreting an argument as invalid.
Here are situations I've either encountered or seen on the net:
- Passing a nil AVAsset due to a MPMediaItem not being local. Workaround is to download from the cloud. No way to force a download
- Your audio session category is incorrect for whatever it is you're doing
- You may need to convert a path based on NSSearchPathForDirectoriesInDomains explicitly to a file URL
- Consecutive calls to startRecordingToOutputFileURL.
- Recording video with device orientation of UIDeviceOrientationFaceUp, UIDeviceOrientationFaceDown, or UIDeviceOrientationUnknown.
- Trying to play Protected music (even though the AVAsset returns NO from hasProtectedContent. Sigh).
- Got any more? let me know.