Ios UIWebView没有';我不再工作了
我重新编辑了我的问题,在我的应用程序中设置我的WebView大约有两周的时间,一切都进展顺利。昨天我只想看看,即使我没有更改任何类的代码,webView是否仍在工作,然后boom SIGABRT。我从昨天起就开始关注这个bug,不明白为什么它仍然给我一个SIGABRT。我按照建议做了一些更改,但仍然没有任何效果。如果在目标c方面有高级技能的人可以帮助我,请告诉我我快疯了,下面是日志消息(如果需要,我可以显示我的所有代码,请随意编辑答案,这样我可以对好答案进行评分,以便帮助后面的人):Ios UIWebView没有';我不再工作了,ios,objective-c,uiwebview,Ios,Objective C,Uiwebview,我重新编辑了我的问题,在我的应用程序中设置我的WebView大约有两周的时间,一切都进展顺利。昨天我只想看看,即使我没有更改任何类的代码,webView是否仍在工作,然后boom SIGABRT。我从昨天起就开始关注这个bug,不明白为什么它仍然给我一个SIGABRT。我按照建议做了一些更改,但仍然没有任何效果。如果在目标c方面有高级技能的人可以帮助我,请告诉我我快疯了,下面是日志消息(如果需要,我可以显示我的所有代码,请随意编辑答案,这样我可以对好答案进行评分,以便帮助后面的人): 这是我的代
这是我的代码:
-(无效)showWebView;
{
//在这里,我在RootViewController中调用我的webview
ViewController*WebViewVC=[[ViewController alloc]init];
[[self-navigationController]pushViewController:WebViewVC动画:是];
[WebViewVC pushIt];
}
//这是我的WebViewController.h
#进口
#进口
@界面ViewController:UIViewController
{
ibuiwebview*myWebView;
}
@属性(非原子,保留)ibuiwebview*myWebView;
-(无效)X按钮;
-(无效)推它;
@结束
//这是我的WebViewController.m
-(无效)推它;
{
导航控制
self.navigationItem.hidesBackButton=YES;
self.navigationItem.leftBarButtonItem=nil;
self.title=@“*****”;
myWebView=[[UIWebView alloc]initWithFrame:self.view.frame];
[self.view addSubview:myWebView];
[自选按钮];
[self WebViewBrowserBackButton];
NSUserDefaults*prefs=[NSUserDefaults standardUserDefaults];
NSString*默认值=[prefs stringForKey:@“myKey”];
NSString*defaults2=[prefs stringForKey:@“mySecondKey”];
NSString*username=默认值;
NSString*password=defaults2;
NSURL*url=[NSURL URLWithString:@“****************”;
NSString*body=[NSString stringWithFormat:@“**********”,用户名,密码];
NSMutableURLRequest*request=[NSMutableUrlRequestWithURL:url缓存策略:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];
request.HTTPMethod=@“POST”;
request.HTTPBody=[body dataUsingEncoding:nsStringencodingConversionLowlossy];
[myWebView加载请求:请求];
}
***由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“-[UIViewController\U LoadViewFromNibName:bundle:]加载了“MyWebViewController”nib,但未设置视图出口。”
***第一次抛出调用堆栈:
(
0 CoreFoundation 0x017e15e4例外预处理+180
1 libobjc.A.dylib 0x015648b6 objc_异常_抛出+44
2 CoreFoundation 0x017e13bb+[N异常提升:格式:][139
3 UIKit 0x005fd6e6-[UIViewController\u loadViewFromNibNamed:bundle:][505
4 UIKit 0x005fddad-[UIViewController loadView]+302
5 UIKit 0x005fe0ae-[UIViewController loadViewIfRequired]+78
6 UIKit 0x005fe5b4-[UIVIEW控制器视图]+35
7锁屏0x00011596-[MyWebViewController pushIt]+246
8锁屏0x00003c0a-[RootViewController showWebView]+202
9 libobjc.A.dylib 0x015767d2-[NSObject性能选择器:][62
10锁屏0x00007f02-[LCYDataBackedTableView表格视图:didSelectRowAtIndexPath:+130
11 UIKit 0x005cc7b1-[UITableView\u SelectRowAtIndex路径:动画:滚动位置:notifyDelegate:+1513
12 UIKit 0x005cc924-[UITableView\u用户选择RowatPendingSelectionIndexPath:+279
13 UIKit 0x005d0908 \uuuuu 38-[uTableView touchesEnded:withEvent:]\uBlock\uInvoke+43
14 UIKit 0x00507183在CACommitHandler块调用+15之后
15 UIKit 0x0050712e\u应用锁定到传真复制支架+403
16 UIKit 0x00506f5a在CACommithandler+532之后
17 CoreFoundation 0x017a94ce\uuuu CFRUNLOOP\uu正在调用\uu OUT\uu来调用\uu观察者\uu回调函数\uuuu+30
18 CoreFoundation 0x017a941f\uu cfrunloopdoobserver+399
19 CoreFoundation 0x01787344 _ucfrunlooprun+1076
20 CoreFoundation 0x01786ac3 CFRunLoopRunSpecific+467
21 CoreFoundation 0x017868db CFRUNLOOPSRUNINMODE+123
22图形服务0x02a659e2 GSEventRunModal+192
23图形服务0x02a65809 GSEventRun+104
24 UIKit 0x004ead3b UIApplicationMain+1225
25锁屏0x0000297d主+125
26 libdyld.dylib 0x020897D启动+1
)
libc++abi.dylib:以NSException类型的未捕获异常终止
将WebViewController的view属性从nib文件连接到文件所有者的view对象
异常跟踪清楚地显示nib中的视图未连接。
加载了“MyWebViewController”nib,但未设置视图出口
您需要设置WebViewOutlet您做了哪些更改?你的代码看起来像什么?另外,请确保“MyWebViewController”nib的“视图”出口仍然连接,并且连接到正确的对象。我所做的更改是“尝试”将我的IBOutlet与xib文件连接,以及在我的视图调用中使用initWithNibName。我将回答我的问题蒂莫西·格罗特,以便向你展示我的密码。谢谢你的回答:)。可能是
here is my code :
- (void)showWebView;
{
//here i call my webview in my RootViewController
ViewController *WebViewVC = [[ViewController alloc] init];
[[self navigationController] pushViewController:WebViewVC animated:YES];
[WebViewVC pushIt];
}
//here is my WebViewController.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface ViewController : UIViewController <UIWebViewDelegate>
{
IBOutlet UIWebView *myWebView;
}
@property (nonatomic, retain) IBOutlet UIWebView *myWebView;
-(void)XButton;
-(void)pushIt;
@end
//here is my WebViewController.m
-(void)pushIt;
{
navigation control
self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = nil;
self.title = @"*****";
myWebView = [[UIWebView alloc] initWithFrame:self.view.frame];
[self.view addSubview:myWebView];
[self XButton];
[self WebViewBrowserBackButton];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *defaults = [prefs stringForKey:@"myKey"];
NSString *defaults2 = [prefs stringForKey:@"mySecondKey"];
NSString *username = defaults;
NSString *password = defaults2;
NSURL* url = [NSURL URLWithString:@"**************"];
NSString* body = [NSString stringWithFormat:@"************", username, password];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];
request.HTTPMethod = @"POST";
request.HTTPBody = [body dataUsingEncoding:NSStringEncodingConversionAllowLossy];
[myWebView loadRequest:request];
}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MyWebViewController" nib but the view outlet was not set.'
*** First throw call stack:
(
0 CoreFoundation 0x017e15e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015648b6 objc_exception_throw + 44
2 CoreFoundation 0x017e13bb +[NSException raise:format:] + 139
3 UIKit 0x005fd6e6 -[UIViewController _loadViewFromNibNamed:bundle:] + 505
4 UIKit 0x005fddad -[UIViewController loadView] + 302
5 UIKit 0x005fe0ae -[UIViewController loadViewIfRequired] + 78
6 UIKit 0x005fe5b4 -[UIViewController view] + 35
7 LockScreen 0x00011596 -[MyWebViewController pushIt] + 246
8 LockScreen 0x00003c0a -[RootViewController showWebView] + 202
9 libobjc.A.dylib 0x015767d2 -[NSObject performSelector:] + 62
10 LockScreen 0x00007f02 -[LCYDataBackedTableView tableView:didSelectRowAtIndexPath:] + 130
11 UIKit 0x005cc7b1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
12 UIKit 0x005cc924 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
13 UIKit 0x005d0908 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
14 UIKit 0x00507183 ___afterCACommitHandler_block_invoke + 15
15 UIKit 0x0050712e _applyBlockToCFArrayCopiedToStack + 403
16 UIKit 0x00506f5a _afterCACommitHandler + 532
17 CoreFoundation 0x017a94ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
18 CoreFoundation 0x017a941f __CFRunLoopDoObservers + 399
19 CoreFoundation 0x01787344 __CFRunLoopRun + 1076
20 CoreFoundation 0x01786ac3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x017868db CFRunLoopRunInMode + 123
22 GraphicsServices 0x02a659e2 GSEventRunModal + 192
23 GraphicsServices 0x02a65809 GSEventRun + 104
24 UIKit 0x004ead3b UIApplicationMain + 1225
25 LockScreen 0x0000297d main + 125
26 libdyld.dylib 0x0208970d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException