I want to embed a youtube video into a webviewer whenever I press a button. I have this code
- (IBAction)testBtn:(id)sender {
NSString *code = @"<iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/1iBIcJFRLBA\" frameborder=\"0\" allowfullscreen></iframe>";
[[self youtubeWebPlayer]loadHTMLString:code baseURL:nil];
}
My problem is, whenever I press the button nothing happens. The webviewer remains blank.
I have put breakpoints in the code to double check that the code is called by my app and it is indeed called.
EDIT***
I have fixed the problem by replacing
[[self youtubeWebPlayer]loadHTMLString:code baseURL:nil];
with
[[self youtubeWebPlayer]loadHTMLString:code baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];