0

我重新编辑了我的问题:在我的应用程序中设置我的 WebView 大约有两个星期,一切都很顺利。昨天我想看看 webView 是否仍在工作,即使我没有更改任何类的代码,并且繁荣 SIGABRT。所以今天我决定将我的 UIWebView 更改为以编程方式编码的 WebView。问题是 xcode 仍然要求我不使用的 IBOutlet :O。如果具有高级客观 c 技能的人可以帮助我,我会发疯的。日志消息:`

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MyWebView" nib but the view outlet was not set.'`
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;
             UIWebView *newWeb;
        }

        //@property (nonatomic, retain) IBOutlet UIWebView *myWebView;
        -(void)XButton;
        -(void)pushIt;
        @end


        //here is my WebViewController.m
            -(void)pushIt;
        {



  self.navigationItem.hidesBackButton = YES;
        self.navigationItem.leftBarButtonItem = nil;


        self.title = @"*****";
        self.title = @"Endosize";
newWeb = [[UIWebView alloc] initWithFrame:self.view.frame];
[self.view addSubview:newWeb];
[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];

        [newWeb loadRequest:request];
    }
4

1 回答 1

1

父视图控制器的 .xib 文件可能连接了 UIWebView。删除该连接并尝试再次运行该应用程序。

于 2013-11-12T14:19:42.857 回答