Voglio riprodurre un video di YouTube nella mia app. Quindi, ho scritto il seguente codiceiOS - UIWebView non funziona a causa di un errore di parsing
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString* html = [NSString stringWithFormat:embedHTML, videoURL, self.view.frame.size.width, self.view.frame.size.height];
[videoView loadHTMLString:html baseURL:nil];
Il videoView è un UIWebView. Questo funzionava bene fino a tardi, la vista non mostra nulla. Solo una vista bianca vuota. E ho avuto questo registro:
*** WebKit discarding exception: <NSRangeException> *** -[__NSCFString substringToIndex:]: Range or index out of bounds
Ho lo stesso problema utilizzando XCode 4.5, iOS 6.0 –
Sì. Questo è anche il mio caso, Xcode 4.5 e iOS 6. Sto scaricando il GM e spero che sia un problema beta –