The issue that I am having is that when I try to pass data to the destinationViewController
with a push segue, it looks as if its not getting passed. When I change the segue to a modal segue everything works perfectly.
[self performSegueWithIdentifier:@"segueToPlayCapturedMedia" sender:self];
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqual:@"segueToPlayCapturedMedia"]) {
MediaPlayerViewController* mediaPlayerVC = segue.destinationViewController;
mediaPlayerVC.fileURL = self.currentMediaFileURL;
NSLog(@"on segue the recieved media file is %@", mediaPlayerVC.fileURL);
}
}
When I run it, I am able to NSLog
the mediaPlayerVC.fileURL
but when I try Logging the fileURL
in viewDidLoad
of the MediaPlayerViewController
, the value is nil
.
It almost seems to me that the instance of MediaPlayerViewController
being displayed is different than the one created during the segue.
Can you show the definition of your property fileURL in mediaPlayerVC.h It should be something like :
@property (strong, nonatomic) Type-mayBe-NSURL *fileURL;
strong is really important !