2014-09-23 12 views
3

내 앱에 일일 견적이있는 섹션이 있으며이 견적은 인터넷의 웹 페이지에서 가져옵니다. 나는 Today Extension을 사용하여 견적을 추가하려고 했으므로 거기서 볼 수 있었지만 연장은 계속해서 공백으로 표시됩니다.오늘 확장 UIWebView

나는 오늘 확장이 스토리 보드에 파일 추가하고, 코드에 대한 구현 파일에서 내가 가진 :

그러나
#import "TodayViewController.h" 
#import <NotificationCenter/NotificationCenter.h> 

@interface TodayViewController() <NCWidgetProviding> 

@end 

@implementation TodayViewController 


-(void)viewDidLoad { 
    [super viewDidLoad]; 
    self.title = @"Today's Scripture"; 
    self.preferredContentSize = CGSizeMake(320, 50); 
    [reader loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.316apps.com/testingdailyreader.html"]cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]]; 
    // timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES]; 




} 

@end 

, 내가 얻을 모두에서 '로드 할 수 없습니다'라는 빈 행이다 알림 센터. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

+0

는이 문제에 대한 해결책을 찾았나요? 나는 지금 같은 문제가있다. – cptdanko

답변

0

다음은 UIWebView에서 WKWebView로 전환 한 방법입니다.

참고 : 스토리 보드로 끌 수있는 UIWebView와 같은 속성은 프로그래밍 방식으로 수행해야합니다.

WebKit/WebKit.h를 헤더 파일로 가져와야합니다. 여기

#import <WebKit/WebKit.h> 

, 구현 :

#import "ViewController.h" 

@interface ViewController() 
@property(strong,nonatomic) WKWebView *webView; 
@end 


@implementation ViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    self.productURL = @"http://www.URL YOU WANT TO VIEW GOES HERE"; 

    NSURL *url = [NSURL URLWithString:self.productURL]; 
    NSURLRequest *request = [NSURLRequest requestWithURL:url]; 
    //[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.316apps.com/testingdailyreader.html"]cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]]; 

    _webView = [[WKWebView alloc] initWithFrame:self.view.frame]; 
    [_webView loadRequest:request]; 
    _webView.frame = CGRectMake(self.view.frame.origin.x,self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height); 
    [self.view addSubview:_webView]; 
    } 
@end 
관련 문제