I have an iOS app where I read the data from the website in a UIWebView which is hidden from the user (don't worry its my own website), parse the data from the resulting HTML, read specific info and put it into NSArrays to display in UITable. All is well and good and works in iOS.
- (void)webViewDidFinishLoad:(UIWebView *)webView2
{
NSLog(@"webViewDidFinishLoad ...");
NSString *htmlSourceCodeStr = [webView2 stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];
}
I was thinking of porting the same app to tvOS. Surprise Surprise UIWebView isn't available in tvOS.
Is there a way for me to load / Fetch website data somehow in tvOS, parse and read the resulting HTML? Is that even possible?
Just make the HTTP request directly using NSURLSession
. You'll get the HTML back as NSData
and can parse it from there just like before. You should probably do the same in your iOS app: if you're not going to show the HTML to the user then there's no point in using something as heavyweight as a web view.