How do you create a sharing extension in iOS8 without a sharing user interface

I used Pocket, and they seem to have created a sharing extension that simply sends the URL to their service without a user interface.

Does anyone have an idea on how to do this? I am new to extensions but very familiar with iOS / Objective-C

enter image description here

enter image description here

+5
source share
1 answer

Figured it out.

Just don't use the built-in SLComposeServiceViewController

@interface ShareViewController : UIViewController @end 

And be sure to call the following function when you're done with the sharing extension

 [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil]; 

In other words, replace the contents of ShareViewController.swift with:

 import UIKit class ShareViewController: UIViewController { override func viewDidLoad() { extensionContext?.completeRequest(returningItems: [], completionHandler: nil) } } 
+7
source

Source: https://habr.com/ru/post/1213922/


All Articles