这里是我的文件。当我点击重新加载按钮时,它会进入我所了解的OBJC中的段错误。我不认为这是网站,但主要是没有得到满足/返回的东西。它在main.m文件中提供了SIGABRT。我试图让僵尸无济于事,如果这是要走的路,请让我知道。当我重新加载UIWebView我得到一个信号SIGABRT在我的main.h文件
//
// main.m
// webKitExp
//
// Created by J.Doe on 8/14/17.
// Copyright © 2017 J.Doe. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
//
// ViewController.h
// webKitExp
//
// Created by J.Doe
// Copyright © 2017 J.Doe. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
@interface ViewController : UIViewController
@property (nonatomic, retain) IBOutlet UIWebView *webView;
@end
//
// ViewController.m
// webKitExp
//
// Created by J.Doe on 8/14/17.
// Copyright © 2017 J.Doe. All rights reserved.
//
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
@synthesize webView;
- (void)viewDidLoad {
[super viewDidLoad];
[UIView setAnimationsEnabled:NO];
NSString *localURL = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:localURL]];
[webView loadRequest:urlRequest];
}
- (IBAction)buttonClicked:(UIButton *)sender {
[webView reload];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
index.html文件可能未找到。尝试加载网页而不是本地文件,看看你是否得到相同的错误 –
试试这个呢? [webView loadRequest:urlRequest]; –
我也试过了webView的loadRequest,但这并没有工作,只要index.html文件,它在同一个文件中,并加载第一次罚款,它只是不重新加载和崩溃,而不是 –