4

I'm currently getting a weird situation. Here's how I get into it. Note that I do NOT get this problem when the first 2 steps are skipped.

  1. I make a background NSURLSession in a Share Extension.
  2. I start a download task.
  3. I call exit(0).

The code looks like this:

NSString *address = @"https://googledrive.com/host/0B5zObXR9UzgmbFpob2J5eXpjNXc/file3m";
self.mySession = [self configureMySession];
NSURL *url = [NSURL URLWithString:address];
NSURLSessionTask *myTask = [self.mySession downloadTaskWithURL:url];
[myTask resume];
exit(0);

With this code the following happens. The extension continually respawns, hangs on launch, respawns, hangs on launch, ad infinitum. Here are some of the log messages.

Aug 12 10:55:16 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27082]): Extension did not initialize in time.

Aug 12 10:55:16 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension): Service only ran for 5 seconds. Pushing respawn out by 5 seconds.

Aug 12 10:55:21 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.apple.imfoundation.IMRemoteURLConnectionAgent): The _DirtyJetsamMemoryLimit key is not available on this platform.

Aug 12 10:55:26 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27085]): Extension is hanging on launch. Killing.

Aug 12 10:55:26 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27085]): Extension did not initialize in time.

Aug 12 10:55:26 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension): Service only ran for 5 seconds. Pushing respawn out by 5 seconds.

Aug 12 10:55:31 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.apple.imfoundation.IMRemoteURLConnectionAgent): The _DirtyJetsamMemoryLimit key is not available on this platform.

Aug 12 10:55:36 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27086]): Extension is hanging on launch. Killing.

Aug 12 10:55:37 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27086]): Extension did not initialize in time.

Aug 12 10:55:37 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension): Service only ran for 5 seconds. Pushing respawn out by 5 seconds.

Aug 12 10:55:42 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.apple.imfoundation.IMRemoteURLConnectionAgent): The _DirtyJetsamMemoryLimit key is not available on this platform.

Aug 12 10:55:47 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27087]): Extension is hanging on launch. Killing.

Aug 12 10:55:47 Asperas-MacBook-Pro-2 com.apple.CoreSimulator.SimDevice.6867B1A7-8694-4D6D-8480-69FE89F39C27.launchd_sim[23018] (com.asperasoft.faspex-app.FaspexExtension[27087]): Extension did not initialize in time.

Anyone know what might be causing this behavior?

For the curious, I am doing this so that the application:handleEventsForBackgroundURLSession:completionHandler: method of my containing app's UIApplicationDelegate class gets called. I realize that it is a little shady, but... there aren't many ways to communicate between a share extension and its containing app, so it's what I got.

EDIT: I'm now using this workaround https://stackoverflow.com/a/24614589/3923882 (UIWebView) so this question isn't really that pressing. Still interested if anyone has an answer though.

Community
  • 1
  • 1
arcticmatt
  • 1,956
  • 1
  • 19
  • 36

0 Answers0