I have scenario which fetching json requests from API and parse it on view. But if API pushes xml link, i need to start xml parse task with AFNetworking. After parsing xml, i am passing xml as parameter(NSData) in to another class method which i am assigning child values with NSXMLParser, after parsing has finished :
-(void)parserDidEndDocument:(NSXMLParser *)parser
{
ViewController *VS = [[VC alloc] init];
[VC vastXMLReturn:vastXMLDictionary rollType:rollType];
}
After sending parameters in ViewController following method is responsible to play video;
-(void)vastXMLReturn:(NSDictionary *)xml rollType:(NSString *)roll
{
NSLog(@"XML responses = %@",xml);
//NSString *mediaDuration = [xml objectForKey:@"mediaDuration"];
NSString *mediaFilePath = [xml objectForKey:@"mediaFilePath"];
//NSArray *trackingLists = [xml objectForKey:@"trackingLinks"];
advertisementURL = [NSURL URLWithString:roll];
[self playVideo:advertisementURL initial_time:0];
}
In PlayVideo Method
-(void)playVideo:(NSURL *)videoURL initial_time:(NSTimeInterval)playerTime
{
theMoviPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
theMoviPlayer.controlStyle = MPMovieControlStyleNone;
[self performSelector:@selector(closeButtonForVideoPlayer) withObject:nil afterDelay:5.0];
theMoviPlayer.movieSourceType = MPMovieSourceTypeFile;
theMoviPlayer.view.transform = CGAffineTransformConcat(theMoviPlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2));
[self.view addSubview:theMoviPlayer.view];
//[theMoviPlayer.moviePlayer requestThumbnailImagesAtTimes:@[ @4.3f ] timeOption:MPMovieTimeOptionExact];
[theMoviPlayer setFullscreen:YES animated:YES];
}
The real problem is after [theMoviPlayer setFullscreen:YES animated:YES]; line, breakpoint jumps in viewDidLoad method which is should not happen because the process will be starting in that method again and program terminates error.
What should i have to do for preventing goes in viewDidLoad method ?
Best Regards