@implementation ShareViewController //这个函数用于判断分享内容的可用性,我们在其中获取分享的内容进行检查 - (BOOL)isContentValid { // Do validation of contentText and/or NSExtensionContext attachments here return YES; } //点击post按钮后出发的方法,我们可以在这里将分享的内容进行上传等操作 - (void)didSelectPost { // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context. [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil]; } //这里用于设置分享插件的附件按钮 - (NSArray *)configurationItems { // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. return @[]; }