Is there some time limit when a segue is triggered and the code is being executed inside prepareForSegue:sender:
?
I mean this, suppose I am inside I am triggering a AVPlayerViewController
but this controller requires a video that must be download asynchronously so, inside prepareForSegue:sender:
I have a code like this:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
AVPlayerVC *playerViewController = (AVPlayerVC *)[segue destinationViewController];
[self.onDemandResources loadResourcesWithTags:@[tag]
runOnCompletion:^{
NSString *pathBundle = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"];
NSURL *videoURL = [NSURL fileURLWithPath:pathBundle];
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
playerViewController.player = player;
[player play];
}];
}
The problem I am having is the [segue destinationViewController]
being presented but the video never playing. The impression I have is that the code takes to long to execute and the segue is already presented.
Any ideas?