Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

TabView App Crash

Hello everyone :D

I'm beginner with Apple development and I'm trying to make an TabBar application.

Ok, no problem here, But, the first view of this app will display an video.

Everything is ok, the video framework, the button, etc. (I've done a video application before, but using the Window based application).

When I lauch the Application, it works fine, without error. But when I touch to play the video, the app crash.

Debugging the app, I've found something in main.m file. here the code:

int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}

what is wrong? can anyone help me?

Thanks a lot!
Post edited by lucashaas on

Replies

  • dany_devdany_dev Posts: 4,700Tutorial Authors, Registered Users
  • lucashaaslucashaas Posts: 2New Users
    dany_dev;349760 said:
    what about posting the code of the "play" button? :rolleyes:
    here the code that I use for video:



    -(IBAction)playMovie:(id)sender
    {
    UIButton *playButton = (UIButton *) sender;

    NSString *filepath = [[NSBundle mainBundle] pathForResource:@"flights_granada_1" ofType:@"mov"];
    NSURL *fileURL = [NSURL fileURLWithPath:filepath];
    MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];

    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(moviePlaybackComplete:)
    name:MPMoviePlayerPlaybackDidFinishNotification
    object:moviePlayerController];

    [moviePlayerController.view setFrame:CGRectMake(playButton.frame.origin.x,
    playButton.frame.origin.y,
    playButton.frame.size.width,
    playButton.frame.size.height)];

    [self.view addSubview:moviePlayerController.view];
    //moviePlayerController.fullscreen = YES;

    //moviePlayerController.scalingMode = MPMovieScalingModeFill;

    [moviePlayerController play];
    }

    - (void)moviePlaybackComplete:(NSNotification *)notification
    {
    MPMoviePlayerController *moviePlayerController = [notification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self
    name:MPMoviePlayerPlaybackDidFinishNotification
    object:moviePlayerController];

    [moviePlayerController.view removeFromSuperview];
    [moviePlayerController release];
    }


    This application, If Window-Based works good. But I need to put this video in a View inside a Tab Bar application. But the app crash =(
  • BopolsBopols Posts: 97Registered Users
    debug and step through the code to see which line trips the error.
Sign In or Register to comment.