iOS - UIWebView not working due to parsing error
Maybe my method for translating youtube URL to correct format will help you:
+ (NSString*)getYTUrlStr:(NSString*)url{ if (url == nil) return nil; NSString *retVal = [url stringByReplacingOccurrencesOfString:@"watch?v=" withString:@"v/"]; NSRange pos=[retVal rangeOfString:@"version"]; if(pos.location == NSNotFound) { retVal = [retVal stringByAppendingString:@"?version=3&hl=en_EN"]; } return retVal;}
I solved it using the following HTML:
<!doctype html>\<html>\<style>body{padding:0;margin:0;}</style>\<iframe width=\"320\" height=\"367\" src=\"http://www.youtube.com/embed/rVd0XWALswk?rel=0\" frameborder=\"0\" allowfullscreen></iframe>\</html>
It has nothing to do with using short URL nor the YouTube URL. It's probably using the embed tag and using the type application/x-shockwave-flash. It's now working perfectly fine on iOS 6 GM.