Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Building iOS 8 Share Extensions: A GitHub Repo with Issues, Sample Code, and Workarounds

Building iOS 8 Share Extensions: A GitHub Repo with Issues, Sample Code, and Workarounds

Share extensions, introduced by Apple in iOS 8, "provide an exciting opportunity for developers of all types of apps to integrate with their customers’ devices like never before," says Bryan Irace, iOS developer at Tumblr. Though, as it is often the case with new technologies, the road to building iOS share extensions is paved not only with fun but also with frustration.

Indeed, as Bryan recounts his experience creating Tumblr app share extension, "we have hit quite a few problems that we ended up needing to work around." Found problems range from what might appear as legitimate bugs waiting to be fixed to utter limitations of current iOS 8 extensions architecture. Here is a short review of all issues Bryan reported.

  • Background file upload does not work

    Although, according to Apple documentation, an extension should be allowed to upload a file hosted in the container shared with the container app through NSURLSessionUploadTask, the engineers at Tumblr have not found a way to get this to actually work, since it seems that, as soon as the share extension is dismissed, the background upload stops.

  • The container app must be opened before the share extension can be effectively used

    This problem only actually affects app updates that install new extensions: the app data already exists somewhere outside of the shared container, and only the container app can migrate it over on its first launch. If that step is not done before using the share extension, it is likely that the user will not be able to accomplish what he is up to, since the extension will not know nothing about the user data (user defaults, keychains, databases, files serialized via NSCoding, etc.)

  • NSFileCoordinator seemingly does not work

    As described in WWDC Session 217, NSFileCoordinator is supposed to be an alternative to NSUserDefaults and SQLite for custom data persistence between an extension and its container app.

  • Share extensions can’t set the status bar color

    A share extension is always displayed with the status bar style of the host application. This could lead to visual color clashes and has no workaround.

  • You can’t exclude your own share extension from your application’s activity controllers

    This is just a glitch affecting apps that provide a share extension to be used from other apps while also providing a custom share functionality. In this case, it might be desirable to exclude the share extension from its container app's activity controller, but it is not possible.

  • Share extensions will only show up if they explicitly support all of the provided activity items

    This is, according to Bryan, the most important issue they have found. To understand it, say you create a share extension that supports either image data or URLs or text. Well, such an extension will only be shown in host apps that explicitly support images and URLs and text.

As Bryan points out, not every developer building a share extension is bound to meet those same limitations, still in the interest of helping other developers, he set up a github page detailing all the issues they have found, including sample code, Radar issues, and workarounds where available. Any developers finding new limitations or workarounds to already known limitations can issue a pull request.

Rate this Article