首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的localNotification坏了

我的localNotification坏了
EN

Stack Overflow用户
提问于 2013-07-28 11:47:45
回答 1查看 62关注 0票数 0

下面的代码包含了我的localNotification:

代码语言:javascript
复制
-(void)scheduleNotification{

    if (self.shouldRemind && [self.dueDate compare:[NSDate date]] != NSOrderedAscending){

        UILocalNotification *localNotification = [UILocalNotification new];
        localNotification.fireDate = self.dueDate;
        localNotification.timeZone = [NSTimeZone defaultTimeZone];
        localNotification.alertBody = self.text;
        localNotification.soundName = UILocalNotificationDefaultSoundName;
        localNotification.userInfo = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.itemId] forKey:@"ItemId"];

        NSLog(@"Scheduled notification %@ for itemId %d", localNotification, self.itemId);

    }
}

我在NSLog中的输出如下:

2013-07-28 15:39:48.684 6月检查表2271:907预定通知{fire date =воскресенье,28июля2013г.,15:40:33Московскоестандартноевремя,时区=欧洲/莫斯科(UILocalNotificationInfiniteRepeatCount)偏移14400,重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下一次火灾日期=воскресенье,28июля2013г.,15:40:33Московскоестандартноевремя,ItemId 0用户信息{ itemId = 0;}

但它没有显示(我尝试在iPhone和模拟器上启动应用程序)。我想知道为什么它在NSLog中完美地显示了NSLog,但是当我等待的时候没有通知。

如有任何建议,将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-28 11:51:12

但[ scheduleLocalNotification:localNotification];?UIApplication sharedApplication ]在哪里?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17907870

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档