因未捕获的异常终止应用程序&#39; NSUnknownKeyException&#39;原因:&#39; [<productdetailsview 0x7c29fa60 =“”> setValue:forUndefinedKey:] </productdetailsview>

时间:2014-09-20 21:34:00

标签: ios objective-c xcode xcode6 nsunknownkeyexception

我对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,一切都很完美!有人有这样的问题吗? 怎么解决?

由于

1 个答案:

答案 0 :(得分:1)

您的productDetailsView是否确实定义了名为description的媒体资源?如果是这样,你看到它的编译警告吗? (Xcode 6似乎使用description比以前更多的问题,因为它在NSObject中使用。)如果它存在并且您更改它并将其引用到其他名称,它应该解决这个问题。

如果您没有描述属性 这个问题,因为某些内容(可能在xib或storyboard中)认为您这样做了。

相关问题