> On 9 May 2017, at 15:41, Peter Tomaselli <vast.gra...@gmail.com> wrote:
> 
> I don't believe you can present a view controller in viewDidLoad. I am away 
> from my computer, so I can't confirm right now, but I do not believe the 
> presenting view controller's view is in the view hierarchy yet during 
> viewDidLoad (exactly as the error message says).

I realised that a few minutes after posting. I moved it into viewWillAppear and 
it sort of works, moved it into viewDidAppear and it works BUT the code should 
be:

-(void) viewDidAppear:(BOOL) theAnimatedFlag
{
NSURL*                                          myMovieFileURL;
AVPlayer*                                       myPlayer;
AVPlayerViewController*         myPlayerViewController;

myMovieFileURL = [[NSBundle mainBundle] URLForResource:@"OrchidDemo-ENG-EX-001" 
withExtension:@"mp4"];
myPlayer = [[AVPlayer alloc] initWithURL:myMovieFileURL];

myPlayerViewController = [[AVPlayerViewController alloc] init];
[self.pMovieView addSubview:myPlayerViewController.view];                       
//***************************************

[self presentViewController:myPlayerViewController animated:YES completion:nil];

myPlayerViewController.player = myPlayer;
[myPlayer play];
}

All the Best
Dave


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to