I was using Pocket and they seem to have created a share extension that simply posts the URL to their service w/oa UI.
Anyone have an idea on how to replicate this? I'm new to extensions but very familiar with iOS/Objective-C
Figured it out.
Just don't use the built in SLComposeServiceViewController
@interface ShareViewController : UIViewController
@end
And make sure to call the following function when done with the share 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)
}
}
handle [self.extensionContext completeRequestReturningItems:@[] completionHandler:blah blah blah];
in share extension's viewdidload: works
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.