ios - 在后台检测应用程序是否已启动

标签 ios objective-c xcode

我想保存应用程序启动的时间,并在检测到启动事件时将其保存到数据库。 我想在每次启动应用程序时保存在数据库中。

我尝试在 Android 中使用该服务执行此操作,这在 iOS 中可行吗?

我在 https://gist.github.com/hpique/7554209 中找到了公共(public)通知列表但它不在那里。

希望有人能帮助我。 谢谢。

最佳答案

最佳选择:

您只想在应用程序启动时节省时间。因此您可以使用 didFinishLaunchingWithOptions 方法。

在 iOS 上,您无法在后台使用此类功能。就像 android 一样,你无法运行该服务。一切都是沙盒化的。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   // App Launched, save the time here
   // Put your Code here

    return YES;
}

关于ios - 在后台检测应用程序是否已启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25199589/

相关文章:

objective-c - 使Twitter提要进入NSArray

iOS/objective-C : Is there any way to see what localNotifications are scheduled?

ios - 如何快速打开 TableView 到选定的详细 View

iphone - 从 tableView 返回单元格时出错

ios - swift : Assets folder not working properly after recovering it back from bin

ios - 针对 Game Center 身份验证的 Xcode 4.6 ARC 警告

ios - 如何在 Xcode 中跟踪多个触摸

ios - 是否可以将 View 从一个 ViewController 动画到下一个 ViewController?

ios - EKCalendarEKCalendar CGcolor未在iPhone日历中设置颜色

ios - iOS 部署目标在真实设备上的神秘问题