【问题标题】:Reading a db again after re-opening the app重新打开应用程序后再次读取数据库
【发布时间】:2014-10-06 13:06:44
【问题描述】:

我正在开发一个应用程序,该应用程序从 parse.com 读取一个数据库,其坐标绘制在 MapKit 地图上。一切正常,但是当我在 parse.com 的网络上手动添加一个新的 pin 时,在按下手机上的主页按钮后打开应用程序时它不会显示。

我可以在哪里以及如何询问应用程序是否被击落?

希望我解释得通俗易懂。

每次使用启动图像等打开应用程序时,从头开始打开应用程序也很不错。但我认为这是不可能的,因为总是必须通过双击手机来关闭后台的应用程序。

感谢回答

【问题讨论】:

  • 在视图中确实加载调用解析函数并将其存储在db中

标签: ios objective-c methods


【解决方案1】:

如果“应用程序已被击落”是指应用程序在按下主页按钮后移至后台,那么要了解此事件,您需要在 appdelegate.m 中实现 applicationDidEnterBackground: 方法

当你开始一个新项目时,这些函数和 cmets 是由 xcode 创建的。

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    NSLog(@"App Background");
    /* Use this method to release shared resources, save user data, 
    invalidate timers, and store enough application state information 
    to restore your application to its current state 
    in case it is terminated later.
    If your application supports background execution, 
    this method is called instead of applicationWillTerminate: 
    when the user quits.
    */
}

要知道应用何时再次打开,请在您的 appdelegate.m 中实现 applicationDidBecomeActive: 方法

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    NSLog(@"App Active");

    /* Restart any tasks that were paused (or not yet started) 
    while the application was inactive. 
    If the application was previously in the background, 
    optionally refresh the user interface.
    */
}

【讨论】:

    猜你喜欢
    • 2018-10-29
    • 2013-12-04
    • 1970-01-01
    • 2016-06-20
    • 2017-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多