1)我将webView
声明为具有强属性(强)的属性viewDidLoad
;
2)在_webView
方法中,我正在检查我的网络常量是否存在。基于此,我将使用名为[[UIWebView alloc] initWithFrame:]
;
3)然后_webView
提供给- (void)viewDidLoad {
[super viewDidLoad];
[self setBaseNaviBarInfo];
if (_webInfoDictionary.count > 0) {
NSString *titile = [_webInfoDictionary objectForKey:@"activityName"];
[self setNaviItemText:titile];
}
[self createViews];
CLS_LOG(@"init create wb view ......");
NSString* url = [_webInfoDictionary objectForKey:@"activityLink"];
[self loadWebViewWithURLString:url];
}
-(void)createViews{
if (!_webView) {
//Crash Now
_webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, STATUS_NAVI_STATUS_HEIGHT, IPHONE_WIDTH, IPHONE_HEIGHT - STATUS_NAVI_STATUS_HEIGHT)];
_webView.delegate = self;
_webView.scalesPageToFit = NO;
_webView.dataDetectorTypes = UIDataDetectorTypeNone;
[self.view addSubview:_webView];
_activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame : CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)] ;
[_activityIndicatorView setCenter: self.view.center] ;
[_activityIndicatorView setActivityIndicatorViewStyle: UIActivityIndicatorViewStyleGray] ;
[self.view addSubview : _activityIndicatorView];
}
}
;
4)最后有时它会在iOS 8或iOS 9或iOS7平台上崩溃,我在此处发布了来自Fabric CrashReport的图片;
{{1}}