share-extension

How to launch a parent iOS App from its App Extension

独自空忆成欢 提交于 2019-12-04 17:19:17
问题 Does any one know how to launch the parent app from the app extension's view controller? I just want to launch the main app from its app extension. 回答1: In the WWDC session Creating Extensions for iOS and OS X, Part 1 around the 22 minute mark the say to use the openURL:completionHandler: method from the UIViewController's extensionContext to open a custom URL scheme [self.extensionContext openURL:[NSURL URLWithString:@"your-app-custom-url-scheme://your-internal-url"] completionHandler:nil];

Share attachment from Mail App with Share extension in iOS

十年热恋 提交于 2019-12-04 14:24:57
问题 Now i'm working on the app that should implement share extension to share attachments from Mail App. It should support different file extensions (almost all types of documents). From Apple docs I understood that i have to use Predicate in my Info.plist, but in answers on SO i found that I have to use it in code. Now I'm stuck on that and can't proceed further. Here is the Predicate that I want to use from this post. SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem

Retrieve google user from ios extension

别说谁变了你拦得住时间么 提交于 2019-12-03 22:25:34
I am trying to create a share extension for my application which requires to login to Google from the extension. I've setup the sharing group keychain and am able to write from the main application and read the extension target. But I can't login to Google from the extension because GIDSignIn.sharedInstance().hasAuthInKeychain() always returns false. Is there any way to login to Google from an extension and how do I do that? Any help would be appreciated. 1. In Bridging-Header.h import <GoogleSignIn/GoogleSignIn.h> import <Google/Core.h> 2. In AppDelegate.swift import Google In application

How to launch a parent iOS App from its App Extension

北慕城南 提交于 2019-12-03 12:14:48
Does any one know how to launch the parent app from the app extension's view controller? I just want to launch the main app from its app extension. In the WWDC session Creating Extensions for iOS and OS X, Part 1 around the 22 minute mark the say to use the openURL:completionHandler: method from the UIViewController's extensionContext to open a custom URL scheme [self.extensionContext openURL:[NSURL URLWithString:@"your-app-custom-url-scheme://your-internal-url"] completionHandler:nil]; arcticmatt I asked a similar question here: Communicating with/opening Containing app from Share extension .

Share attachment from Mail App with Share extension in iOS

感情迁移 提交于 2019-12-03 09:04:51
Now i'm working on the app that should implement share extension to share attachments from Mail App. It should support different file extensions (almost all types of documents). From Apple docs I understood that i have to use Predicate in my Info.plist, but in answers on SO i found that I have to use it in code. Now I'm stuck on that and can't proceed further. Here is the Predicate that I want to use from this post . SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ( ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf" || ANY

iOS Share Extension issue when sharing images from Photo library

£可爱£侵袭症+ 提交于 2019-12-02 20:19:22
问题 Below is a code that I use to share images within my "ShareViewController.m". NSExtensionItem *item = [self.extensionContext.inputItems objectAtIndex:i]; NSItemProvider *itemProvider = item.attachments.firstObject; if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeURL]) { [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSData *data, NSError *error) { NSLog(@"%@", data); // the rest of uploading script goes here }]; } It all

iOS Share Extension issue when sharing images from Photo library

我是研究僧i 提交于 2019-12-02 09:04:49
Below is a code that I use to share images within my "ShareViewController.m". NSExtensionItem *item = [self.extensionContext.inputItems objectAtIndex:i]; NSItemProvider *itemProvider = item.attachments.firstObject; if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeURL]) { [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSData *data, NSError *error) { NSLog(@"%@", data); // the rest of uploading script goes here }]; } It all works fine if I share an image from WhatsApp. But it doesn't work if I want to share an image from Photo

ios swift share-extension: what are all and the best ways to handle images?

ぐ巨炮叔叔 提交于 2019-11-29 16:23:25
i have a share-extension handling different kinds of formats, like images. for attachment in content.attachments as! [NSItemProvider] { if attachment.hasItemConformingToTypeIdentifier(kUTTypeImage as String) { attachment.loadItem(forTypeIdentifier: kUTTypeImage as String, options: nil) { data, error in if error == nil { var contentData: Data? = nil //data could be raw Data if let data = data as? Data { contentData = data //data could be an URL } else if let url = data as? URL { contentData = try? Data(contentsOf: url) } //data could be an UIImage object (e.g. ios11 screenshot editor) else if

ios swift share-extension: what are all and the best ways to handle images?

一曲冷凌霜 提交于 2019-11-28 09:49:56
问题 i have a share-extension handling different kinds of formats, like images. for attachment in content.attachments as! [NSItemProvider] { if attachment.hasItemConformingToTypeIdentifier(kUTTypeImage as String) { attachment.loadItem(forTypeIdentifier: kUTTypeImage as String, options: nil) { data, error in if error == nil { var contentData: Data? = nil //data could be raw Data if let data = data as? Data { contentData = data //data could be an URL } else if let url = data as? URL { contentData =