我正在尝试在我的ViewController中播放视频。Mediaplayer.framework和所有的头文件都在我的框架文件夹中,包括MediaPlayer.h文件。但是当我把
#import "TutorialViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@interface TutorialViewController ()
@end
@implementation TutorialViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
MPMoviePlayerController *player =
[[MPMoviePlayerController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
//---play movie---
[player play];
[super viewDidLoad];
}
- (void) movieFinishedCallback:(NSNotification*) aNotification {
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
// Do any additional setup after loading the view.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end在我的.m文件中,我得到一个错误,指出'MediaPlayer/MediaPlayer.h‘文件找不到。这意味着什么,我如何解决这个问题?
发布于 2012-09-07 10:52:48
从项目中删除框架并重新添加它应该可以解决这个问题。我建议您打开项目的目录,并确保在将框架添加到项目中时,您只引用了框架,而没有复制它。如果框架存在于你的项目文件夹中,那么删除它,否则就从你的项目中删除它的引用。
然后导航到:
项目Navigator>>Your应用程序的target>>Summary选项卡(滚动到底部)
单击“链接框架”下的"+“,从这里您可以将对框架的引用重新添加到您的项目中。

发布于 2013-05-13 21:49:07
我希望上面的一些解决方案对其他人有效。不幸的是,这一次它们对我不起作用
但是..。这对我来说很管用。这有点“老生常谈”,但它让项目再次构建起来(我现在可能正好赶上我的最后期限)。
我使用了我需要的头文件的绝对完整路径,例如
#import "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.h"这就去掉了令人讨厌的惊叹号“找不到文件”。我将继续调查原因,因为这明显指向xCode中的一些路径问题
发布于 2015-09-04 05:35:31
我相信这次行动遗漏了包含UIKit的。这就是我的遭遇。即使框架已经包含在项目中,它也会给出与上面描述的相同的错误。
https://stackoverflow.com/questions/12310998
复制相似问题