SimplyKiwi
SimplyKiwi

Reputation: 12444

What is causing this crash?

In my app I have a UIAlertView show every time the app launches, everything works fine if I don't click the the 'Dismiss' button but if I do click the 'Dismiss' button, the app will crash about 3 seconds later.

I got the crash log from the console, if anyone knows why it is crashing please let me know

  2011-03-20 15:47:05.833 App[8080:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSCFString 0x6e04920> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key mystatsbutton.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x01a71be9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x01bc65c2 objc_exception_throw + 47
    2   CoreFoundation                      0x01a71b21 -[NSException raise] + 17
    3   Foundation                          0x001016cf _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x0010163d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x005808d6 -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x019e82cf -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x0057f2ed -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x00581081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x00439a94 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
    10  UIKit                               0x00437709 -[UIViewController loadView] + 120
    11  UIKit                               0x004375e3 -[UIViewController view] + 56
    12  App                            0x000084e2 -[LoadupView endview] + 132
    13  Foundation                          0x0011f7a5 __NSFireTimer + 125
    14  CoreFoundation                      0x01a52fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    15  CoreFoundation                      0x01a54594 __CFRunLoopDoTimer + 1220
    16  CoreFoundation                      0x019b0cc9 __CFRunLoopRun + 1817
    17  CoreFoundation                      0x019b0240 CFRunLoopRunSpecific + 208
    18  CoreFoundation                      0x019b0161 CFRunLoopRunInMode + 97
    19  GraphicsServices                    0x02349268 GSEventRunModal + 217
    20  GraphicsServices                    0x0234932d GSEventRun + 115
    21  UIKit                               0x0039842e UIApplicationMain + 1160
    22  App                            0x000022de main + 84
    23  App                            0x00002281 start + 53
)
terminate called after throwing an instance of 'NSException'

Upvotes: 0

Views: 342

Answers (4)

WrightsCS
WrightsCS

Reputation: 50727

CHeck your XIB and make sure that it does not have a grayed out (Xcode 3.x) mystatsbutton. Just make sure there are no references of it on your XIB. If there is a reference to it, remove it and you should be good to go.

Upvotes: 1

justin
justin

Reputation: 104708

it's very likely that your memory's somehow been trashed -- what you think is something which knows about mystatsbutton happens to be a NSString when the relevant program is loaded, not some object in the graph of your NIB.

this can happen for several reasons. typically, this means you are using an object after it has been freed. iow, your reference counting is probably incorrect. try running with zombies enabled.

it could also be that you have assigned a pointer value an object you did not intend to. illustration: UIView * view = [NSString string];.

it could also be something less obvious, such as you forgot to remove an observer when it was dealloc'ed.

those are the more common reasons. it may be a good start.

it's also a good idea to remove all compiler warnings (using a high setting), as well as static analyzer issues.

Upvotes: 3

Anomie
Anomie

Reputation: 94844

From the error message, it seems that you are loading a view controller from a nib, where the nib is trying to connect something to an outlet named mystatsbutton but the class doesn't contain an outlet with that name.

Upvotes: 3

mmccomb
mmccomb

Reputation: 13817

Can you post your main UIViewController's interface and implementation?

It looks like you haven't wired an IBOutlet to a property named mystatsbutton.

Upvotes: 1

Related Questions