NSNotificationCenter related crash on iOS 3.2
Our app works fine on iOS 4.2 and 4.3. However, on iOS 3.2 it crashes at this line
[[NSNotificationCenter defaultCenter] postNotificationName:@"notificnname" object:nil];
The function postNotificati开发者_运维技巧onName is available since iOS 2.0. I am building my app with iOS 4.3 and the target sdk is set as 3.2. Any ideas what could be causing the crash.
Thanks.
agree with pt2ph8's comment above.
Mostly likely some object registered for a notification, then got dealloced without unregistering for a notification. Thus the notification center is sending notifications to dead objects.
Make sure in your dealloc (or viewDidUnload for view controllers) that you are unregistering that object from all notifications.
精彩评论