1

我尝试在 UIWebView 中加载书签(可读性)。但我有一些问题......你能告诉我,这里有什么问题吗?

文章加载,但不可读。

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSString *searchURL = @"(function(){window.baseUrl='https://www.readability.com';window.readabilityToke‌​n='';var s=document.createElement('script');s.setAttribute('type','text/javascript');s.se‌​tAttribute('charset','UTF-8');s.setAttribute('src',baseUrl+'/bookmarklet/read.js');document.documentElemen‌​t.appendChild(s);})()";

    //NSURL *url =  [NSURL URLWithString:[searchURL stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
    NSURL *article = [NSURL URLWithString:@"http://www.nytimes.com/2013/01/12/world/asia/us-can-speed-afghan-exit-obama-says.html?hp&_r=0"];


    // NSURL *url = [NSURL URLWithString:searchURL];
    [webview loadRequest:[NSURLRequest requestWithURL:article]];
    //[webview loadRequest:[NSURLRequest requestWithURL:url]];
    [webview stringByEvaluatingJavaScriptFromString:searchURL];


    // Do any additional setup after loading the view from its nib.
}

我将感谢您的帮助!

4

0 回答 0