• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Exception on launch when clicking on an NSUserNotification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception on launch when clicking on an NSUserNotification


  • Subject: Re: Exception on launch when clicking on an NSUserNotification
  • From: Alex Kac <email@hidden>
  • Date: Thu, 26 Feb 2015 19:49:42 -0700

It would be a fantastic clue! Except … its not printed in the console, or in the xcode console, or anywhere. So I have no idea. My guess is that the OS is swallowing the exception for launch purposes, which does me no good.

I thought so too that it would have a problem decoding an archived object - however as I wrote in my original email:

1: I am not using any custom objects. Only NSStrings. I have tested with both having a userInfo (again with an NSString), and without. In fact, I’m no longer using userInfo - same issue.
2: It unarchives just fine if the app is already running - it only fails when it launches the app.

NSUserNotification *localNotif = [[NSUserNotification alloc] init];
localNotif.deliveryDate = [NSDate dateWithTimeIntervalSinceReferenceDate:alarmNotification.timeToFire];

			localNotif.soundName = soundFile;
			localNotif.title = title;
			localNotif.informativeText = moreInfo;
			[localNotif setHasActionButton: YES];
			[localNotif setActionButtonTitle: LOC(@"Snooze")];
			localNotif.identifier = [NSString stringWithFormat:@"Alarm-%@",stringInformantID] ;


			//set the repeat and category
			if ([localNotif respondsToSelector:@selector(setAdditionalActions:)])
			{
				NSMutableArray* additionalActions = [NSMutableArray array];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze1"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(60)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze5"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(5*60)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze15"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(15* 60)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze30"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(30* 60)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze60"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(60* 60)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze120"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(120* 60)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze86400"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(kSecondsPerDay)]]];
				[additionalActions addObject:[NSUserNotificationAction actionWithIdentifier:@"Snooze172800"
																					  title:[NSString stringWithFormat:LOC(@"Snooze for %@"), StringForDuration(kSecondsPerDay*2)]]];

				localNotif.additionalActions = additionalActions;
			}

[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification: localNotif];

> On Feb 26, 2015, at 7:37 PM, Jens Alfke <email@hidden> wrote:
>
>
>> On Feb 26, 2015, at 6:17 PM, Alex Kac <email@hidden> wrote:
>>
>> However I'm having a problem on launching the app by tapping on the notification. My app gets an applicationWillFinishLaunching, and then gets an exception before it hits applicationDidFinishLaunching.
>>
>> https://www.dropbox.com/s/nmf6qr97su43plh/Screenshot 2015-02-25 21.38.37.png?dl=0
>
> That screenshot doesn’t show what the exception is — that’s likely the important clue. If you continue from that breakpoint the exception should get logged to the debugger console.
>
> From the stack it looks like it’s a problem decoding an archived object that’s a property of the notification. My guess is that you put a custom object in your notification userInfo and for some reason it fails to unarchive.
>
> —Jens



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Exception on launch when clicking on an NSUserNotification
      • From: Kyle Sluder <email@hidden>
    • Re: Exception on launch when clicking on an NSUserNotification
      • From: Jens Alfke <email@hidden>
References: 
 >Exception on launch when clicking on an NSUserNotification (From: Alex Kac <email@hidden>)
 >Re: Exception on launch when clicking on an NSUserNotification (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Exception on launch when clicking on an NSUserNotification
  • Next by Date: Re: How to prevent app activation on NSUserNotification action
  • Previous by thread: Re: Exception on launch when clicking on an NSUserNotification
  • Next by thread: Re: Exception on launch when clicking on an NSUserNotification
  • Index(es):
    • Date
    • Thread