Question

i guess my problem isn't a tough one.

I'm working on a local notification.

UILocalNotification* localNotification = [[UILocalNotification alloc] init];
    localNotification.fireDate = pickerDate;
    localNotification.alertBody = @"%@ additional text",[self nameTextField].text;
    localNotification.alertAction = @"Show";
    localNotification.timeZone = [NSTimeZone defaultTimeZone];
    localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
    localNotification.soundName = UILocalNotificationDefaultSoundName;

so far it works all as expected, but the Alertbody just shows <null> "additional text"

why?

Was it helpful?

Solution

You can't do that, try

[NSString stringWithFormat:@"%@ additional text", [self nameTextField].text];

The way you're doing is to show string literals but will not work with variables.

I'm actually surprised the compiler let you get away with that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top