- (voID)applicationDIDFinishLaunching:(NSNotification *)aNotification{ // Insert code here to initialize your application NSUserNotification *notification = [[NSUserNotification alloc] init]; [notification setTitle: @"Title"]; [notification setSubTitle: @"SubTitle"]; [notification setinformativeText: @"informative Text"]; [notification setHasActionbutton: YES]; [notification setActionbuttonTitle: @"Action button"]; [notification setotherbuttonTitle: @"Other button"]; [notification setSoundname: NSUserNotificationDefaultSoundname]; [notification setDeliveryDate: [NSDate dateWithTimeIntervalSinceNow: 10]]; [[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification: notification];}
我得到,没有失败,
无 *** 作按钮或其他按钮。
解决方法 如前面的回答中已经陈述的,通知类型需要被设置为提醒要显示的动作按钮。如果要将应用程序的默认通知样式设置为alert,则需要在info.pList中使用值alert定义键NSUserNotificationAlertStyle。有关详细信息,请参阅Apple的info.plist keys reference:
总结NSUserNotificationAlertStyle SpecifIEs whether the notification style should be banners,alerts,or none. The default value is banners,which is the recommended style.
以上是内存溢出为你收集整理的可可 – NSUser通知不显示 *** 作按钮全部内容,希望文章能够帮你解决可可 – NSUser通知不显示 *** 作按钮所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)