Monday, 15 August 2011

objective c - Instance of a UIView throwing an exception when deleted from UIViewController -



objective c - Instance of a UIView throwing an exception when deleted from UIViewController -

this question has reply here:

what mean? “'nsunknownkeyexception', reason:this class not key value coding-compliant key x” 46 answers

so i'm trying create analog clock app practice. have clockview.h/.m configured correctly , analog clock works fine. problem whenever delete 1 instance of clock view main view controller, application crashes , throws exception. have insight on why happening? here's code view controller:

#import <uikit/uikit.h> #import "clockview.h" @interface viewcontroller : uiviewcontroller <uitableviewdelegate, uitableviewdatasource> @property (strong, nonatomic) clockview *clockview; @property (strong, nonatomic) iboutlet clockview *clockview1; @end

whenever comment out first property, app crashes (even though don't utilize anywhere else in code). linked uiviewcontroller in storyboard , sec property linked uiview.

here's code viewcontroller.m

@implementation viewcontroller - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { } homecoming self; } - (void)viewdidload { [super viewdidload]; [self.clockview1 setclockbackgroundimage:[uiimage imagenamed:@"clock-background.png"].cgimage]; [self.clockview1 sethourhandimage:[uiimage imagenamed:@"clock-hour-background.png"].cgimage]; [self.clockview1 setminhandimage:[uiimage imagenamed:@"clock-min-background.png"].cgimage]; [self.clockview1 setsechandimage:[uiimage imagenamed:@"clock-sec-background.png"].cgimage]; } @end

here exception i'm getting;

terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<viewcontroller 0x78ea6880> setvalue:forundefinedkey:]: class not key value coding-compliant key clockview.' [....] *** first throw phone call stack: libc++abi.dylib: terminating uncaught exception of type nsexception

this error

"this class not key value coding-compliant key xxxx"

usually means ui elements storyboard has connection xxxx, in case that's clockview property.

i suggest go thru elements of ui in storyboard , check in connections inspector nil pointing xxxx (clockview)

objective-c xcode

No comments:

Post a Comment