Josh Hudnall
Josh Hudnall

Reputation: 1031

iOS Share Extension Doesn't Terminate

I've created an iOS share extension with a custom UI (not using SLComposeServiceViewController) and everything works great.

Once the extension is invoked, it takes a shared URL or text and sends it. That's all it does and it works well.

The custom UI is simple. One image view that shows a graphic indicating that it is sending and then that changes to say "Sent" once done. Then this fades out.

What is going wrong is after this is done, the extension seems to disappear, but I can't control the host application anymore. It's as if an invisible window or view is on top of everything. (For example, an image rotator in Safari still rotates, but I can't scroll or tap links or buttons, etc.)

I'm calling [self.extensionContext completeRequestReturningItems:nil completionHandler:nil]; once the share is done, and as I understand it, that should dismiss my UI. I've also tried [self.view removeFromSuperview] without any luck.

Happens on Simulator and Device. Is there something I'm missing?

Edit: This is what the view hierarchy of a simple app I built to test sharing looks like in Reveal before and after sharing. The app has two buttons: share text and share url, each of which bring up a standard share sheet.

Before

http://joshh.is/1utYnKS

After

http://joshh.is/1rdVo34

Upvotes: 5

Views: 1885

Answers (1)

Josh Hudnall
Josh Hudnall

Reputation: 1031

Ok, I don't know why it took me 10 hours to realize that I was not including a call to super inside of my beginRequestWithExtensionContext: method.

I don't know what other problems that caused, but it certainly caused my problem above.

Upvotes: 4

Related Questions