1.Xcode出现错误。
Undefined symbols for architecture x86_64:
"_IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification", referenced from:
-[IJKMoviePlayerSvodViewController installMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerSvodViewController removeMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerPplayViewController installMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerPplayViewController removeMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerUplayViewController installMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
-[IJKMoviePlayerUplayViewController removeMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
"_IJKMPMoviePlayerLoadStateDidChangeNotification", referenced from:
-[IJKMoviePlayerSvodViewController installMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerSvodViewController removeMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerPplayViewController installMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerPplayViewController removeMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerUplayViewController installMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
-[IJKMoviePlayerUplayViewController removeMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
"_IJKMPMoviePlayerPlaybackDidFinishNotification", referenced from:
-[IJKMoviePlayerSvodViewController installMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerSvodViewController removeMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerPplayViewController installMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerPplayViewController removeMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerUplayViewController installMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
-[IJKMoviePlayerUplayViewController removeMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
"_IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey", referenced from:
-[IJKMoviePlayerSvodViewController moviePlayBackDidFinish:] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerPplayViewController moviePlayBackDidFinish:] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerUplayViewController moviePlayBackDidFinish:] in IJKMoviePlayerUplayViewController.o
"_IJKMPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
-[IJKMoviePlayerSvodViewController installMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerSvodViewController removeMovieNotificationObservers] in IJKMoviePlayerSvodViewController.o
-[IJKMoviePlayerPplayViewController installMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerPplayViewController removeMovieNotificationObservers] in IJKMoviePlayerPplayViewController.o
-[IJKMoviePlayerUplayViewController installMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
-[IJKMoviePlayerUplayViewController removeMovieNotificationObservers] in IJKMoviePlayerUplayViewController.o
"OBJC_CLASS$_IJKFFMoviePlayerController", referenced from:
objc-class-ref in IJKMoviePlayerSvodViewController.o
objc-class-ref in IJKMoviePlayerPplayViewController.o
objc-class-ref in IJKMoviePlayerUplayViewController.o
"OBJC_CLASS$_IJKFFOptions", referenced from:
objc-class-ref in IJKMoviePlayerSvodViewController.o
objc-class-ref in IJKMoviePlayerPplayViewController.o
objc-class-ref in IJKMoviePlayerUplayViewController.o
"OBJC_CLASS$_LiveVideoCoreSDK", referenced from:
objc-class-ref in LiveShowViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因分析:
这个错误的发生原因一般是“XXX”这个文件(类库)虽然引入了工程中,但是由于种种原因(常见于多人开发,svn同步不规范)导致“XXX”并未被添加到project.pbxproj这个文件中-或者说是项目路径不对,在打包阶段就把三方库和.m文件都加入到编译文件中,如果路径错误则会导致编译失败IJKMoviePlayerSvodViewController.o就说明错误是在编译阶段。
解决方法
1.缺少第三方库中的类
在 target -> Build Phases -> Link Binary With Libraries 中添加,类所在的第三方库。
如果存在,则很有可能是三方库引入路径错误,解决方法删除该三方库,重新导入项目(注意不要直接拉入项目中,此方法很容易导致路径问题),采用Add Files to "targe-name"的方法更加安全。
2如果是自己项目中的类
在targets界面中找到Build Phases,根据提示信息“XXX”来判断缺少什么文件,一般如果缺少自定义的文件,XXX会是缺少的类名,那么就在Complie Sources中加入该文件。如果缺少类库,则在Link Binary With Libraries中加入该类库。