Switch from autorelease to release within the dealloc method of you app delegate. Or change it to use the setter (self.viewcontroller = ...)
The way you read the message is that NSCFString doesn't have the method. Pondering why it would think it was an NSCFString helps you track down that it is a memory issues. Apple has a really good guide on understanding memory management. Sent from my iPhone On Jan 16, 2011, at 2:06 PM, digi_0315 <[email protected]> wrote: > I'm using cocos2d with MPMoviePlayerViewController class, but when I > tryed to catch notification status when the movie is finished I got > this error: > > Terminating app due to uncaught exception > 'NSInvalidArgumentException', reason: '-[NSCFString > movieFinishedCallback]: unrecognized selector sent to instance > 0x5d23730' > > *******my playVideoController.m are: > > @implementation PlayVideoViewController > > +(id) scene{ > > CCScene *scene = [CCScene node]; > CCLayer *layer = [credits node]; > [scene addChild: layer]; > return scene; > } > -(id)initWithPath:(NSString *)moviePath{ > > if ((self = [super init])){ > movieURL = [NSURL fileURLWithPath:moviePath]; > [movieURL retain]; > > > > playerViewController = [[MPMoviePlayerViewController alloc] > initWithContentURL:movieURL]; > > player = [playerViewController moviePlayer]; > > [[NSNotificationCenter defaultCenter] > addObserver:self > selector:@selector(movieFinishedCallback) > name:MPMoviePlayerPlaybackDidFinishNotification > object:player]; > > [[[CCDirector sharedDirector] openGLView] > addSubview:playerViewController.view]; > [player play]; > > } > return self; > } > > -(void)movieFinishedCallback{ > CCLOG(@"video finished!!"); > } > > ****************in .h: > > #import <UIKit/UIKit.h> > #import "cocos2d.h" > #import <MediaPlayer/MediaPlayer.h> > > @interface PlayVideoViewController : CCLayer { > NSURL *movieURL; > MPMoviePlayerViewController *playerViewController; > MPMoviePlayerController *player; > } > +(id) scene; > > @end > > > ***********************and I call it in appDelegate.m: > > - (void) applicationDidFinishLaunching:(UIApplication*)application > { > > CC_DIRECTOR_INIT(); > CCDirector *director = [CCDirector sharedDirector]; > > [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; > > EAGLView *glView = [director openGLView]; > [glView setMultipleTouchEnabled:YES]; > > [CCTexture2D > setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];// > kEAGLColorFormatRGBA8 > > NSString *path = [[NSBundle mainBundle] pathForResource:@"intro" > ofType:@"mov" inDirectory:nil]; > viewController = [[[PlayVideoViewController alloc] > initWithPath:path] autorelease]; } > > > > what i'm doing wrong? anyone can help me please?? I'm try to solve it > since a lot of hours ago but I can't! > > -- > You received this message because you are subscribed to the Google Groups > "cocos2d discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/cocos-discuss?hl=en. > -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
