我在聊天应用程序中使用AVPlayer但是我在选定的音频文件中遇到了错误但是音频文件在浏览器中正确播放.
错误域= AVFoundationErrorDomain代码= -11800"操作无法完成"UserInfo = {NSUnderlyingError = 0x60800024fde0 {Error Domain = NSOSStatusErrorDomain Code = -16170"(null)"},NSLocalizedFailureReason =发生未知错误(-16170),NSLocalizedDescription =操作无法完成}
我正在实现以下方法.
-(void)setupAVPlayerForURL:(NSURL*)url
{
AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
AVPlayerItem *anItem = [AVPlayerItem playerItemWithAsset:asset];
playerAud = nil;
playerAud = [AVPlayer playerWithPlayerItem:anItem];
[self startTimer];
[playerAud play];
[anItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopAudioPlay) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];
}
And also implement the fallowing observer.
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
//// playerAud is instance of AVPlayer
if (object == playerAud.currentItem && …Run Code Online (Sandbox Code Playgroud) ld:找不到-lPods-Project_name-FMDB clang的库:错误:链接器命令失败,退出代码为1(使用-v查看调用)
xcode8.1中的上述错误,但代码在xcode 7.x版本中成功运行.
ios ×2