Core Bluetooth - Performing Long-Term Actions in the Background
<p>This is from the Core Bluetooth Background Processing for iOS Apps section found in official docs:</p>

<p><strong>Performing Long-Term Actions in the Background</strong></p>

<blockquote>
  <p>Some apps may need to use the Core Bluetooth framework to perform
  long-term actions in the background. As an example, imagine you are
  developing a home security app for an iOS device that communicates
  with a door lock (equipped with Bluetooth low energy technology). The
  app and the lock interact to automatically lock the door when the user
  leaves home and unlock the door when the user returns—all while the
  app is in the background. When the user leaves home, the iOS device
  may eventually become out of range of the lock, causing the connection
  to the lock to be lost. At this point, the app can simply call the
  connectPeripheral:options: method of the CBCentralManager class, and
  because connection requests do not time out, the iOS device will
  reconnect when the user returns home.</p>
</blockquote>

<p>Okay, we have an app which locks/unlocks doors as appropriate... So as pointed out, this works when app is in the background (most likely in the suspended mode). Now, lets move on (with quoting docs):</p>

<blockquote>
  <p>Now imagine that the user is away from home for a few days. If the app
  is terminated by the system while the user is away, the app will not
  be able to reconnect to the lock when the user returns home, and the
  user may not be able to unlock the door. For apps like these, it is
  critical to be able to continue using Core Bluetooth to perform
  long-term actions, such as monitoring active and pending connections.</p>
</blockquote>

<p>So, if the user was away from home for a few days, and app has been terminated by the iOS, we will have to implement state preservation and restoration, so that iOS relaunch the app when connection request is detected, and let the app to unlock the door. Related quotes:</p>

<blockquote>
  <p>In the case of the home security app described above, the system
  would monitor the connection request, and re-relaunch the app to
  handle the centralManager:didConnectPeripheral: delegate callback when
  the user returned home and the connection request completed.</p>
</blockquote>

<p>This all make sense, but pay attention to this part again:</p>

<blockquote>
  <p>Now imagine that the user is away from home for a few days. If the app
  <strong>is terminated by the system</strong> while the user is away, the app will not be able to reconnect to the lock when the user returns home, and
  the user may not be able to unlock the door. For apps like these, it
  is critical to be able to continue using Core Bluetooth to perform
  long-term actions...</p>
</blockquote>

<p>Does this means, if the app is forcefully killed by the user at some moment while he was away from home, that this will work as well ? Means when user comes home, the door will unlock anyway, or he must manually relaunch the app to unlock the door?</p>

<p>I am asking this, because of how relaunch of terminated apps works. It is not the same when user kills the app, and when iOS kills the app <strong>which supports background execution</strong>:</p>

<blockquote>
  <p>Apps that support background execution may be relaunched by the system
  to handle incoming events. If an app is terminated for any reason
  other than the user force quitting it, the system launches the app
  when one of the following events happens...</p>
</blockquote>

<p><a href="https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html" rel="nofollow noreferrer">Source</a></p>

<p>So once again, if the user was away for a few days and he has closed the app by double tapping Home button and dragging up, will he be able to enter his home without manually relaunching the app?</p>