首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在iPad应用程序中不工作的application控制器?

在iPad应用程序中不工作的application控制器?
EN

Stack Overflow用户
提问于 2012-02-06 14:07:19
回答 1查看 445关注 0票数 0

下面是我的代码,用于设置mpmoviecontroller。虽然我能听到视频的声音,但我看不到视频的图片。我已经在网上搜索过了,但是我找不到我的代码的错误。有人能帮我摆脱困境吗?

(注意路径和url是正确的~:)

代码语言:javascript
复制
- (IBAction)playClicked:(id)sender {
NSString *path=[[NSBundle mainBundle] bundlePath];
path=[path stringByAppendingPathComponent:@"movies.bundle"];
path=[path stringByAppendingPathComponent:@"mean.mp4"];

NSURL *url=[NSURL fileURLWithPath:path];
NSFileManager *filemanager=[NSFileManager defaultManager];

if([filemanager fileExistsAtPath:path]){
    NSLog(@"File exists at %@! You should be able to see the movie!:)",path);
    MPMoviePlayerController *player=[[MPMoviePlayerController alloc] initWithContentURL:url];
    if(player){
        player.scalingMode = MPMovieScalingModeNone;
        player.controlStyle=MPMovieControlStyleFullscreen;
        player.movieSourceType=MPMovieSourceTypeFile;
        [player.view setFrame:CGRectMake(0, navigationBar.bounds.size.height, self.view.bounds.size.width, self.view.bounds.size.height-navigationBar.bounds.size.height)];
        [self.view addSubview:player.view];
        [player prepareToPlay];
        NSLog(@"Ready to play for %@!",player.duration);
        [player play];
        NSLog(@"Played!");
    }
}else{
    NSLog(@"File does not exist!:(");
}

}

运行时错误:

代码语言:javascript
复制
    2012-02-06 08:54:40.248 Board[1604:11f03] File exists at /Users/admin/Library/Application Support/iPhone Simulator/5.0/Applications/C468351E-3150-4397-B73A-8505D099B2C5/Board.app/movies.bundle/mean.mp4! You should be able to see the movie!:)
    2012-02-06 08:54:40.276 Board[1604:11f03] Ready to play for (null)!
    2012-02-06 08:54:40.277 Board[1604:11f03] Played!
    [Switching to process 1604 thread 0x13e03]
    [Switching to process 1604 thread 0x11f03]
    2012-02-06 08:54:40.733 Board[1604:11f03] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
    in /System/Library/Frameworks/Security.framework/Versions/A/Security
    2012-02-06 08:54:40.740 Board[1604:11f03] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
   in /System/Library/Frameworks/Security.framework/Versions/A/Security
   2012-02-06 08:54:40.886 Board[1604:11f03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
   in /System/Library/Frameworks/Security.framework/Versions/A/Security
   2012-02-06 08:54:40.894 Board[1604:11f03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
    in /System/Library/Frameworks/Security.framework/Versions/A/Security
    2012-02-06 08:54:40.905 Board[1604:11f03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
    in /System/Library/Frameworks/Security.framework/Versions/A/Security
    2012-02-06 08:54:40.928 Board[1604:11f03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
    in /System/Library/Frameworks/Security.framework/Versions/A/Security
    2012-02-06 08:54:40.940 Board[1604:11f03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
    in /System/Library/Frameworks/Security.framework/Versions/A/Security
    2012-02-06 08:54:40.947 Board[1604:11f03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
    Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
    Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
    in /System/Library/Frameworks/Security.framework/Versions/A/Security
EN

回答 1

Stack Overflow用户

发布于 2012-02-07 13:16:51

似乎添加下面的代码将完成这项工作。

代码语言:javascript
复制
player.movieSourceType=MPMovieSourceTypeFile;
[self.view addSubview:player.view];
[player setFullscreen:YES];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9161313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档