【问题标题】:Thread 1: signal SIGBRT [duplicate]线程 1:信号 SIGBRT [重复]
【发布时间】:2014-03-27 13:31:22
【问题描述】:

我在运行我的 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

【问题讨论】:

  • 你能显示你的 viewCotnroller.h 吗?
  • @Basheer_CAD my ViewController.h: ` #import @interface ViewController : UIViewController{ IBOutlet UIWebView *webview; @property (nonatomic, 保留) UIWebView *webview; @end`
  • 首先,您可以删除界面中对 Web 视图的重新声明,其次要暂时解决此问题,您可以在 .h 文件中添加 outlet 调用它 connect @Robbie

标签: ios ipad ios7


【解决方案1】:

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

【讨论】:

  • 是的,我的 ViewController.h: ` #import @interface ViewController : UIViewController{ IBOutlet UIWebView *webview; @property (nonatomic, 保留) UIWebView *webview; @end`
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2023-03-12
    • 2018-10-25
    • 1970-01-01
    • 2019-01-12
    • 2017-01-30
    • 1970-01-01
    • 2011-09-11
    相关资源
    最近更新 更多