0

我重新编辑了我的问题,在我的应用程序中设置我的 WebView 大约有两个星期,一切都很顺利。昨天我想看看 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
4

1 回答 1

1

将 WebViewController 的视图属性从 nib 文件连接到文件所有者的视图对象。

异常跟踪清楚地表明您在 nib 中的视图未连接。

于 2013-11-12T12:57:28.533 回答