【发布时间】:2012-06-20 18:18:26
【问题描述】:
在 iOS 5.1.1 上生成 UILocalNotification 时,我无法在 alertBody 中显示特殊字符,例如“%”。 Apple 的文档特别指出 '%' char 的字符串格式化程序是 '%%'。
以下是相关代码:
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:20.0];
localNotification.alertBody = [NSString stringWithFormat:@"Test %%"];
NSLog(@"Local notification's alert body is %@",localNotification.alertBody);
localNotification.alertAction = @"View";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
如果我尝试绝对指定 alertBody,也会发生同样的事情: localNotification.alertBody = @"测试%";
我尝试了相同的代码来生成一个完美运行的 UIAlertView。这是 iOS 错误吗?
【问题讨论】:
标签: ios ios5 uilocalnotification ios4