gpt4 book ai didi

ios - 当应用程序在前台使用 ios 8 时,调度程序 UILocalNotification 不工作

转载 作者:行者123 更新时间:2023-11-29 12:14:07 25 4
gpt4 key购买 nike

UILocalNotification 未触发当应用程序处于前台模式时,但相同的代码在应用程序处于后台时工作正常,从日志中获取此信息时,用户信息始终为 Null该应用程序处于前台模式。

fire date = Friday, September 4, 2015 at 6:28:37 PM India Standard Time, time zone = Asia/Kolkata (GMT+5:30) offset 19800, repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = (null), user info = (null)

请检查此示例代码,我正在我的应用程序中使用此代码 example code

最佳答案

您是否在触发通知时设置了 UserInfo?在示例代码中,它是 nil。检查我是否设置了 userinfo = andInfo:@{@"a":@"ab"}

[[MKLocalNotificationsScheduler sharedInstance] scheduleNotificationOn:[NSDate dateWithTimeIntervalSinceNow:10]
text:@"Hey there"
action:@"View"
sound:nil
launchImage:nil
andInfo:@{@"a":@"ab"}];

在日志中我得到

Received: {fire date = Friday, September 4, 2015 at 12:25:44 PM India Standard Time, time zone = Asia/Kolkata (GMT+5:30) offset 19800, repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = (null), user info = { a = ab; }}

关于ios - 当应用程序在前台使用 ios 8 时,调度程序 UILocalNotification 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32391345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com