推送通知ios

发布于 2025-01-07 10:10:07 字数 70 浏览 3 评论 0原文

如果我的应用程序已关闭,并且 iPhone 收到该应用程序的推送通知,它会收到该通知并打开该应用程序吗?

谢谢

If my app is closed , and the iphone receives a push notification for that app, will it receive it and open the app?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

时光瘦了 2025-01-14 10:10:07

否,如果收到消息,则不会打开应用程序。

如果用户选择查看通知,您的应用程序将启动。
因此,如果用户没有对通知做出反应,您的应用程序将不会启动。

如果您的应用程序已经在前台运行,那么应用程序委托将直接收到通知。

No if the message is received it will not open the app.

You app wil get launched if the user selects to view the notification.
Thus if the user does not react to the notifications your app will not be launched.

If your app is already running and in the foreground than the app delegate will receive the notification directly.

微凉徒眸意 2025-01-14 10:10:07

是的,如果单击“查看”按钮,它将启动,并且应用程序将调用委托方法。
如果单击“关闭”按钮,它将丢弃该通知。

 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {  

    }

欲了解更多信息 http://www.raywenderlich.com/ 3443/apple-push-notification-services-tutorial-part-12http://mobiforge.com/developing/story/programming-apple-push-notification -服务

Yes it will launch if "View" button is clicked and application will call the delegate method.
If clicked on "close" button it will discard the notification.

 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {  

    }

For more info http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12 and http://mobiforge.com/developing/story/programming-apple-push-notification-services

十秒萌定你 2025-01-14 10:10:07

当您打开应用程序时出现通知,您可以使用以下代码。

- (void)applicationDidEnterBackground:(UIApplication *)application
{
  UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];

  // Current date
  NSDate *date = [NSDate date]; 

  // Add one second to the current time
  NSDate *dateToFire = [date dateByAddingTimeInterval:1];

  // Set the fire date/time
  [localNotification setFireDate:dateToFire];
  [localNotification setTimeZone:[NSTimeZone defaultTimeZone]];    

  // Setup alert notification
  [localNotification setAlertBody:@"Tap to return to TestApp" ];
  [localNotification setAlertAction:@"Open TestApp"];
  [localNotification setHasAction:YES];

  [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}

有关此内容的更多信息,您可以使用参考参考。

愿这段代码对您有所帮助。

when the notification aries that time you open the application that for you can use the following code.

- (void)applicationDidEnterBackground:(UIApplication *)application
{
  UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];

  // Current date
  NSDate *date = [NSDate date]; 

  // Add one second to the current time
  NSDate *dateToFire = [date dateByAddingTimeInterval:1];

  // Set the fire date/time
  [localNotification setFireDate:dateToFire];
  [localNotification setTimeZone:[NSTimeZone defaultTimeZone]];    

  // Setup alert notification
  [localNotification setAlertBody:@"Tap to return to TestApp" ];
  [localNotification setAlertAction:@"Open TestApp"];
  [localNotification setHasAction:YES];

  [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}

And more information regarding this thing you can use Refer the Reference.

May this code helping to you.

好听的两个字的网名 2025-01-14 10:10:07

是的,当您收到推送时 - 它会在屏幕上显示为一条警报,并在顶部(您可以在“设置”中选择一种方式)显示一条消息,该消息将在几秒钟后消失。如果您点击推送通知 - 它将打开应用程序。但是当你收到推送时,App不会随着收到推送而自动打开。仅在用户点击推送后。

Yes, when you receive push - it appears as an alert on the screen on appears in the top (you can choose a way in Settings) as a message which will disappear after some seconds. If you click on push notification - it'll open App. But when you receive push, App will not be opened automatically with a receiving a push. Only after user clicks on push.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文