According to the docs, sending sendMessage
from the WatchKit app will wake the iPhone app if it is inactive.
I would like to know the differences between such a wakeup app startup and a normal one. Surely a background process has a lot of differences to a normal foreground app. However, I could not find a thorough documentation on the subject.
Here's what I found so far:
- Since such a "wakeup" is not a normal app startup, I expect
didFinishLaunchingWithOptions
to receive a speciallaunchOptions
key. After all, the user did not start the app on the home screen, so there should be an indication inlaunchOptions
. But when I tried it out,launchOptions
wasnil
. Doesn't that contradict the docs? - I also thought there should be differences because there is no UI present in a background process. So perhaps
[UIScreen mainScreen]
might benil
. But there seems to be no difference inmainScreen
in the background process. In myAppDelegate.m
, the code that creates the main window seems to run exactly the same way as in the foreground process. - I also expect that there are limits to the background process. Since the user did not actively start the process, I'm pretty sure that it cannot run for an infinite amount of time. Maybe there are also stricter memory limits.
- Is there a way I can debug such a background process in XCode? Can I tell XCode "wait until the app runs on the iPhone", such that the debugger gets attached as soon as the app runs?
- I also tried this in a React Native app. The Objective-C code in
AppDelegate.m
seemed to run exactly the same way, regardless of background or foreground process. However, the whole Javascript part of the app did not run (which is kind of expected, because in a background process, we do not need any React UI). But there must be a difference in the process that causes the Javascript part to not run.
Please don't consider this question to be about "more than one question". The question of this post is quite clear: I want to know all the differences between a didReceiveMessage
background process and a normal one. In the enumeration above, I just listed all the differences I would expect or that I have encountered so far, and the lack of documentation on those topics.