Search code examples
iosstoryboardios8-share-extensionshare-extension

Share Extension UI takes too much time to load


I'm developing a simple, custom Share Extension: "custom" means I'm not extending SLComposeServiceViewController but a regular UIViewController.

The extension loads an image from Photos app and displays it. The UI is very simple: there's a UIImageView and two buttons ("cancel" and "save").

The issue: when this extension loads for the first time it takes about 5 seconds to display: any further image load, performed in the same session, results in an image loading in less then half a second.

So, to summarize: the first time the share extension displays, it does it very slow. But, if you select another image and you click the share extension icon, it displays immediatly (no lags, it's perfect).

Initially I thought there was an issue with the image loading into the imageView: I commented out the related code but it wasn't the problem.

There wasn't a main/GUI queue issue either.

I suppose there's something related to the storyboard initialization but, again, it's a view and two buttons, why does it take so long to load?


Solution

  • I found what it was and I want to share it with you.

    This thing happens only:

    1. if you test your share extension using the simulator;
    2. if you test your share extension using a connected device;

    if you disconnect the device it works just fine :-)