Sushma Satish
Sushma Satish

Reputation: 2433

iOS 6.1 UIWebview crashes when clicked on play youtube video inside a webpage

I am trying to show a website inside app. The website which i am trying to load has got a youtube video in it. The website loads properly in UIWebView and also lists the youtube video. But when I click on youtube video, the app crashes.

Crash log just says:

setting movie path: http://r19---sn-aig7knl7.c.youtube.com/videoplayback?...............

The website when loaded in Safari works fine, it even plays youtube video full screen.

Please help me in fixing this issue.

11 Feb 2013 - UPDATE

The issue is observed only on iOS Simulator 6.1. On Device everything works fine.

Detailed Info:

I have a custom UIViewController(TestWebViewController) which has an instance of UIWebView and implements UIWebViewDelegate. I have added a UIViewController in Storyboard and added UIWebView inside it, linked this UIViewController to my custom TestWebViewController and linked IBOutlet and delegate for UIWebView.

On Clicking a button, I am programmatically instantiating TestWebViewController using

TestWebViewController *testWebVC = [self.storyboard instantiateViewControllerWithIdentifier:@"testWebVC"];
testWebVC.view.frame = self.view.frame;
[testWebVC loadWebViewWithUrl:TEST_URL];

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

Upvotes: 10

Views: 2113

Answers (3)

Wali Haider
Wali Haider

Reputation: 1272

As scott said in his comment, I removed my breakpoint for all exceptions and my error went away.

Hope this will help to others.

Upvotes: 3

Muhammad Zeeshan
Muhammad Zeeshan

Reputation: 39

    TestWebViewController *testWebVC = [self.storyboard instantiateViewControllerWithIdentifier:@"testWebVC"];

[testWebVC LoadWebView:@"YOUR URL STRING"];
[self presentViewController:testWebVC animated:YES completion:nil];

 AND in TestWebViewController class

-(void)LoadWebView:(NSString *)address {
addressStr = address;
}

- (void)viewDidLoad
{
[super viewDidLoad];
url = [NSURL URLWithString:addressStr];
NSURLRequest *request = [NSURLRequest requestWithURL:url] ;
[myWebView loadRequest:request] ;
}

Upvotes: 0

Vizllx
Vizllx

Reputation: 9246

Modal view on iOS 5.0 and iOS 5.1 is the problem that causes crash on full screen video, AFAIK. They just changed hierarchy of views in that version of iOS (parentViewController and presentingViewController) and that is the aftermath. I asked about it long time ago here and one more same question is here and still no one knows what to do.

First of all, they fixed it in 6.0, I guess, that's good.

For 5.1 we changed design a little and avoided modal view. Do it, if it is possible in your situation.

Upvotes: 0

Related Questions