-[UIApplication cancelLocalNotification:nil] crashes in iOS 7

Originator:zach
Number:rdar://15483051 Date Originated:15-Nov-2013 12:27 PM
Status:Open Resolved:
Product:iOS SDK Product Version:7.0.4
Classification:Other Bug Reproducible:Always
 
Summary:
When canceling local notifications, if you pass in `nil` to -cancelLocalNotification:, everything goes boom and is ruined forever. Or, at least, momentarily. The app crashes, is what I'm trying to get at.

Steps to Reproduce:
1. Have code that boils down to `[[UIApplication sharedApplication] cancelLocalNotification:nil];` somewhere in your app.
2. Have it run.

Expected Results:
1. Nothing. Nil was passed in. Silently stop working 'cause theres nothing else to do.

Actual Results:
The world ends. Maximum entropy occurs. Etc etc. At the end of the day, my app crashed and I was sad.

2013-11-15 12:21:04.525 LocalNotification[38091:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
	0   CoreFoundation                      0x0174c5e4 __exceptionPreprocess + 180
	1   libobjc.A.dylib                     0x014bb8b6 objc_exception_throw + 44
	2   CoreFoundation                      0x01700316 -[__NSPlaceholderArray initWithObjects:count:] + 390
	3   CoreFoundation                      0x01723ce9 +[NSArray arrayWithObject:] + 73
	4   SpringBoardServices                 0x03c6671c +[SBSLocalNotificationClient cancelLocalNotification:] + 44
	5   UIKit                               0x0023e9fe -[UIApplication cancelLocalNotification:] + 43
	6   LocalNotificationDemo                   0x00001c71 -[LNAppDelegate application:didFinishLaunchingWithOptions:] + 129
	…
)

Regression:
I don't know if this ever didn't happen. I can't install older OS's on my test devices to check.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!