线程1:信号SIGABRT

时间:2014-02-25 11:05:42

标签: ios ipad ios7

运行我的xcode项目时收到错误。我的应用程序始终有效,所以我无法真正理解为什么它不再起作用。有没有人有想法?我发现它是由于我正在调用的方法无效引起的。我似乎无法弄清楚这个错误的位置..任何人?

我得到的错误:

2014-02-25 11:52:06.784 Chemie Xpert - PSE[1381:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x8d49be0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** First throw call stack:
(
    0   CoreFoundation                      0x023625e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x014bc8b6 objc_exception_throw + 44
    2   CoreFoundation                      0x023f26a1 -[NSException raise] + 17
    3   Foundation                          0x00f709ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x00edccfb _NSSetUsingKeyValueSetter + 88
    5   Foundation                          0x00edc253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   Foundation                          0x00f3e70a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
    7   UIKit                               0x002bfa15 -[UIRuntimeOutletConnection connect] + 106
    8   libobjc.A.dylib                     0x014ce7d2 -[NSObject performSelector:] + 62
    9   CoreFoundation                      0x0235db6a -[NSArray makeObjectsPerformSelector:] + 314
    10  UIKit                               0x002be56e -[UINib instantiateWithOwner:options:] + 1417
    11  UIKit                               0x002c02fb -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 165
    12  UIKit                               0x0001d3bb -[UIApplication _loadMainNibFileNamed:bundle:] + 58
    13  UIKit                               0x0001d6e9 -[UIApplication _loadMainInterfaceFile] + 245
    14  UIKit                               0x0001c28f -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 543
    15  UIKit                               0x0003087c -[UIApplication handleEvent:withNewEvent:] + 3447
    16  UIKit                               0x00030de9 -[UIApplication sendEvent:] + 85
    17  UIKit                               0x0001e025 _UIApplicationHandleEvent + 736
    18  GraphicsServices                    0x022c02f6 _PurpleEventCallback + 776
    19  GraphicsServices                    0x022bfe01 PurpleEventCallback + 46
    20  CoreFoundation                      0x022ddd65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    21  CoreFoundation                      0x022dda9b __CFRunLoopDoSource1 + 523
    22  CoreFoundation                      0x0230877c __CFRunLoopRun + 2156
    23  CoreFoundation                      0x02307ac3 CFRunLoopRunSpecific + 467
    24  CoreFoundation                      0x023078db CFRunLoopRunInMode + 123
    25  UIKit                               0x0001badd -[UIApplication _run] + 840
    26  UIKit                               0x0001dd3b UIApplicationMain + 1225
    27  Chemie Xpert - PSE                  0x0000247d main + 141
    28  libdyld.dylib                       0x0598d70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

我的代码:

main.m:

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

ViewController.m:

#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize webview;

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"localHTML"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webview loadRequest:request];

    webview.scalesPageToFit = YES;
    webview.scrollView.bounces = NO;
    webview.scrollView.minimumZoomScale = 1;
    webview.scrollView.bouncesZoom = FALSE;

}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (BOOL)prefersStatusBarHidden
{
    return YES;
}
@end

2 个答案:

答案 0 :(得分:0)

也许您从NIB中删除了UIView对象,并替换为UIWebView。 这很好,但您应该将webView链接到xib文件中"view"的{​​{1}}属性。

答案 1 :(得分:0)

将webview设置为IBOutlet吗?这可能是原因。