質問を再編集しました。アプリケーションで WebView をセットアップしたのは約 2 週間で、すべてがうまく機能していました。昨日、クラスのコードを変更しなくても webView がまだ機能しているかどうかを確認したかったので、SIGABRT をブームにしました。私は昨日からこのバグに悩まされていて、なぜそれがまだ SIGABRT を与えるのか理解できません。目標 c の高度なスキルを持つ誰かが私を助けてくれるなら、私は夢中になっています。これがログメッセージです (必要に応じてすべてのコードを表示できます。回答を自由に編集して、良い回答を順番に評価できるようにしてください)。私の後の人々を助けるために):
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