几分钟后,iPhone无法得到通知

时间:2021-02-05 01:18:21

I have a location app. When the user select an address he/she can set a radius before the chosen address to get alerted. The local notification is set upped in the didEnterRegion: The thing that I noticed is if the user sets the alert and close the app and passes more than 15 minutes, no notification appears. Some time when the user press the lock or home button the notification trigger. and if it is less than that everything works fine.

我有一个位置应用程序。当用户选择地址时,他/她可以在所选地址之前设置半径以获得警报。在didEnterRegion中设置了本地通知:我注意到的事情是,如果用户设置警报并关闭应用程序并超过15分钟,则不会显示任何通知。有些时候用户按下锁定或主页按钮通知触发器。如果它小于那个一切正常。

The app has two views. The intro view, where the user can choose an address and the second view with the map.

该应用有两个视图。用户可以选择地址的介绍视图和带有地图的第二个视图。

Do you guys have any idea what might be happening?

你们有什么想法可能会发生什么吗?

Regards

问候

1 个解决方案

#1


0  

Are you using UILocalNotification?. If you do, you have 2 consider 2 scenarios in your AppDelegate.m:

你在使用UILocalNotification吗?如果您这样做,您可以在AppDelegate.m中考虑2个场景:

1) The app was closed.

1)该应用程序已关闭。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //local notification
    UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

    if ([[notification.userInfo objectForKey:@"your key"] isEqual:@"your object"])
    {
       // do something
    }
}

2: The app is still alive.

2:应用程序还活着。

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
   // same as before
}

#1


0  

Are you using UILocalNotification?. If you do, you have 2 consider 2 scenarios in your AppDelegate.m:

你在使用UILocalNotification吗?如果您这样做,您可以在AppDelegate.m中考虑2个场景:

1) The app was closed.

1)该应用程序已关闭。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //local notification
    UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

    if ([[notification.userInfo objectForKey:@"your key"] isEqual:@"your object"])
    {
       // do something
    }
}

2: The app is still alive.

2:应用程序还活着。

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
   // same as before
}