0

tab-bar appなどのさまざまな機能を使用して my を実行しようとしているときに、最近、 の最初のタブに を追加しました。私の知る限り、コーディングに問題はありませんが、最初のタブに webview を追加しようとして以来、アプリを実行しようとしているときに取得し続けます:UITableViewmapviewwebviewfirstviewcontrollerbreakpoint/errorThread 1: signal SIGBRT.

私はいくつか読んだことがありますが、mi xib file /storyboard の展開を 6.0 (現在使用している) ではなく iOS 5.0 に変更し、"Use Autolayout"チェックしていない場合は削除する必要があると誰かが言いました。しませんでしたが。これに対する考えや解決策はありますか?

これが私のfirstviewcontroller.hのコーディングです

#import <UIKit/UIKit.h>


@interface FirstViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *webView;

@end

firstviewcontroller.m

#import "FirstViewController.h"

@interface FirstViewController ()

@end

@implementation FirstViewController
@synthesize webView;

- (void)viewDidLoad
{

    NSString *website = @"http://www.google.com";
    NSURL *url = [NSURL URLWithString:website];
    NSURLRequest *requestUrl = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestUrl];
    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];

}

@end

main.m :

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));      // <--- HERE's where it says SIGBRT
    }
}

すべての出力:

2013-01-04 11:27:06.697 My Corp[784:13d03] Unknown class ViewController in Interface Builder file.
2013-01-04 11:27:06.716 My Corp[784:13d03] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FirstViewController 0x808fbf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key myWebView.'
*** First throw call stack:
(0x1800012 0x11c5e7e 0x1888fb1 0xc72711 0xbf3ec8 0xbf39b7 0xc1e428 0x32a0cc 0x11d9663 0x17fb45a 0x328bcf 0x1ede37 0x1ee418 0x1ee648 0x1ee882 0x20fed9 0x20fd14 0x20e1ea 0x20e06c 0x20c1cc 0x20c9b6 0x1f0753 0x1f0a7b 0x1f1964 0x154877 0x15b5a3 0x153eed 0x13db56 0x13ddbf 0x13df55 0x146f67 0x10afcc 0x10bfab 0x11d315 0x11e24b 0x10fcf8 0x1cc9df9 0x1cc9ad0 0x1775bf5 0x1775962 0x17a6bb6 0x17a5f44 0x17a5e1b 0x10b7da 0x10d65c 0x289d 0x27c5)
libc++abi.dylib: terminate called throwing an exception
(lldb) 
4

2 に答える 2

1

.h ファイルで UIWebViewDelegate を設定し、xib で webview のデリゲートをアタッチします

于 2013-01-04T10:25:07.853 に答える
1

あなたが犯した過ちは、クラッシュレポートに明確に記載されていました

[<FirstViewController 0x808fbf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key myWebView.'

それを解決するには、InterfaceBuilder の左側のペインにあるXIBそのクラスを右クリックします。File owner黄色の警告アイコンが付いた名前のオブジェクトが見つかりますmyWebView。そのアウトレット接続で [削除] をクリックし、コードをコンパイルします。コンセントを接続した後、コードで IBOutlet を削除し、XIB で接続を削除するのを忘れました。

于 2013-01-04T10:37:27.827 に答える