UIWebView编译器要求我不使用Objective c的IBOutlet

时间:2013-11-12 14:10:04

标签: ios objective-c uiwebview webview

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

*** 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];
    }

1 个答案:

答案 0 :(得分:1)

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