小编San*_*gat的帖子

UIWebView在iOS 8中显示空白屏幕

我有一个应用程序,我可以下载PDF并将其存储在iPhone中.它在iOS 7中完美运行(我目前在iOS 8上运行),在iOS 8中运行应用程序时,webView只保持空白.我不知道出了什么问题.

#import "ISJMMisalViewController.h"
#import "SWRevealViewController.h"

@implementation ISJMMisalViewController
@synthesize activityImageView;

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:YES];

    [self.webView addSubview:activityImageView];
    [activityImageView startAnimating];

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle] resourcePath]stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
        NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@"misalLocal.pdf"];

        //Now create Request for the file that was saved in your documents folder
        NSURL *url = [NSURL fileURLWithPath:filePath];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

        dispatch_async(dispatch_get_main_queue(), ^{

            [self.webView setUserInteractionEnabled:YES];
            [self.webView setDelegate:self];
            [self.webView loadRequest:requestObj];
            [self.webView setScalesPageToFit:YES];
            [activityImageView stopAnimating];
            [activityImageView removeFromSuperview];

        });
    });

}

- (void)viewDidLoad …
Run Code Online (Sandbox Code Playgroud)

pdf uiwebview ios ios8

10
推荐指数
1
解决办法
7092
查看次数

标签 统计

ios ×1

ios8 ×1

pdf ×1

uiwebview ×1