user3437016
user3437016

Reputation: 59

How to solve crash in my iOS Application

While I am testing my iOS application its getting crashed at some point. the crash log as follows can any one please suggest me what might be the reasons to crash. and how can i easily understand where crash is occurs from this crash log data

Thread 0 Crashed:
0   libobjc.A.dylib                 0x0000000192f881d0 objc_msgSend + 16
1   UIKit                           0x0000000189c7b2c8 -[_UIModalItemsCoordinator _notifyDelegateModalItem:tappedButtonAtIndex:] + 120
2   UIKit                           0x0000000189c7b1e8 -[_UIModalItemAlertContentView tableView:didSelectRowAtIndexPath:] + 984
3   UIKit                           0x0000000189b6d794 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1260
4   UIKit                           0x0000000189c2e230 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 236
5   UIKit                           0x0000000189ac246c _applyBlockToCFArrayCopiedToStack + 352
6   UIKit                           0x0000000189a2e4a0 _afterCACommitHandler + 500
7   CoreFoundation                  0x0000000186a330a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
8   CoreFoundation                  0x0000000186a3032c __CFRunLoopDoObservers + 368
9   CoreFoundation                  0x0000000186a306b8 __CFRunLoopRun + 760
10  CoreFoundation                  0x00000001869716cc CFRunLoopRunSpecific + 448
11  GraphicsServices                0x000000018c655c08 GSEventRunModal + 164
12  UIKit                           0x0000000189aa2fd8 UIApplicationMain + 1152
13  whirlpool-minerva               0x0000000100047834 0x100024000 + 145460
14  libdyld.dylib                   0x000000019356ba9c start + 0

Upvotes: 1

Views: 200

Answers (1)

kambala
kambala

Reputation: 2501

A delegate of UIAlertView is deallocated before the alert is dismissed.

If you have an object that is set to be a delegate of UIAlertView and the object may 'die' at some point of app execution (possibly when alert is on screen), then you must set alert view's delegate property to nil in -dealloc method. You have to save a reference to the created alert.

Simple example:

@property (nonatomic, strong) UIAlertView *alert;
...
self.alert = [[UIAlertView alloc] initWith... delegate:self ...];
[self.alert show];
...
- (void)dealloc {
    self.alert.delegate = nil;
}

Upvotes: 2

Related Questions