【问题标题】:Terminating app due to uncaught exception 'NSUnknownKeyException' reason: '[<productDetailsView 0x7c29fa60> setValue:forUndefinedKey:] [duplicate]由于未捕获的异常“NSUnknownKeyException”原因而终止应用程序:“[<productDetailsView 0x7c29fa60> setValue:forUndefinedKey:] [重复]
【发布时间】:2014-09-20 21:34:00
【问题描述】:

Xcode 6 有问题!!

我在运行时遇到如下问题:

Terminating app due to uncaught exception 'NSUnknownKeyException', 
reason: '[<productDetailsView 0x7c29fa60> setValue:forUndefinedKey:]: 
this class is not key value coding-compliant for the key description.' 

应用程序在启动时崩溃:

Class STinAppPurchaseMngr.m  ------> STinAppPurchaseMngr: inAppPurchaseManager 

//Called when app start

    -(void)initialize:(STAppDelegate*)delegate {
    [self requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
        if (success) {
            initialized_ = YES;
        } else {
            STLog(@"<Error> Unable to retrieve in-app purchase product list");
        }

    }];
    self.MyAppDelegate = delegate;

    [[productDetailsView sharedInstance] setMyAppDelegate:self.MyAppDelegate];   //Here I have Thread 1: signal SIGABRT
}


//Class productDetailsView.m ————>productDetailsView : UIView

+(productDetailsView*) sharedInstance {

    static dispatch_once_t once;
    static productDetailsView * sharedInstance;
    dispatch_once(&once, ^{                           //Here I have Thread 1: signal SIGABRT
        sharedInstance = [[self alloc] init];     
    });
    return sharedInstance;
}

Xcode 5 一切正常!有人有这样的问题吗? 如何解决?

谢谢

【问题讨论】:

    标签: ios objective-c xcode xcode6 nsunknownkeyexception


    【解决方案1】:

    您的productDetailsView 是否真的定义了一个名为description 的属性?如果是这样,您是否看到它的编译警告? (Xcode 6 似乎使用description 比以前更容易出现问题,因为它在NSObject 中的使用。)如果它存在并且您将其更改并引用它为其他名称,它应该清除问题。

    如果您没有描述属性那就是问题,因为某些东西(可能在 xib 或情节提要中)认为您有。

    【讨论】:

    • 菲利普谢谢你!!它在没有只读属性的情况下被重新声明!!!
    猜你喜欢
    • 2017-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-17
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2012-06-01
    相关资源
    最近更新 更多