2009-06-07 4 views
1

Pourquoi est-ce que j'obtiens cette erreur bizarre? alt text http://img266.imageshack.us/img266/2203/help.tif Des idées?Pourquoi l'éditeur de liens se plaint-il des symboles manquants?

mise en œuvre:

#import "VideoView.h" 
#import <MediaPlayer/MediaPlayer.h> 

@implementation VideoView 
@synthesize player; 

- (void)playVideoWithURL:(NSURL *)url showControls:(BOOL)showControls { 
    if (!player) { 
     player = [[MPMoviePlayerController alloc] initWithContentURL:url]; 

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishPlaying:) name:MPMoviePlayerPlaybackDidFinishNotification object:player]; 

     if (!showControls) { 
      player.scalingMode = MPMovieScalingModeAspectFill; 
      player.movieControlMode = MPMovieControlModeHidden; 
     } 

     [player play]; 
    } 
} 

- (IBAction)playVideoWithControls { 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mov"]; 
    NSURL *url = [NSURL fileURLWithPath:path]; 
    [self playVideoWithURL:url showControls:YES]; 
} 


- (void)didFinishPlaying:(NSNotification *)notification { 
    if (player == [notification object]) { 
     [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player]; 
     [player release]; 
     player = nil; 
    } 
} 


- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview 
    // Release anything that's not essential, such as cached data 
} 


- (void)dealloc { 
    [super dealloc]; 
} 


@end 

tête:

#import <UIKit/UIKit.h> 
#import <MediaPlayer/MediaPlayer.h> 


@interface VideoView : UIViewController { 
    MPMoviePlayerController *player; 

} 
@property (nonatomic, retain) MPMoviePlayerController *player; 
- (IBAction)playVideoWithControls; 


@end 

Répondre

5

Le MPMoviePlayerController est MediaPlayer.framework que vous avez oublié de lien.

+0

Que voulez-vous dire par "lien vers"? Je l'ai ajouté dans mes fichiers .m & .h –

+5

Double-cliquez sur la cible sous Cibles dans l'arborescence Groupes et fichiers. Dans le premier onglet, il y a une liste Bibliothèques liées, cliquez sur Plus et ajoutez l'infrastructure MediaPlayer. – zoul

+0

là nous allons! merci pour cela, n'a jamais su comment faire cela. La première fois que je joue avec un framework –

Questions connexes