ios8-share-extension

How to create an iOS share extension for contacts

99封情书 提交于 2021-02-08 13:35:19
问题 I am trying to create an iOS share extension to share contacts using the following code: let contactType = "public.vcard" override func viewDidLoad() { let items = extensionContext?.inputItems var itemProvider: NSItemProvider? if items != nil && items!.isEmpty == false { let item = items![0] as! NSExtensionItem if let attachments = item.attachments { if !attachments.isEmpty { itemProvider = attachments[0] as? NSItemProvider } } } if itemProvider?.hasItemConformingToTypeIdentifier(contactType)

Crash occurs when executing Share Extension twice in system Files to share file to app

与世无争的帅哥 提交于 2020-08-07 05:07:33
问题 The app uses Share Extension to import a string of .txt files to Core Data. And then syncs the Core Data to iCloud. There is an entity called Item . When sharing a new item in system Files through Share Extension, the code needs to calculate the order for the new item to be imported. And the code is: import Foundation import CoreData @objc(Item) public class Item: NSManagedObject, Identifiable { class func nextOrder() -> Int { let keyPathExpression = NSExpression.init(forKeyPath: "order") let

iOS Share Extension: get URL of page when sharing via context menu in Safari

送分小仙女□ 提交于 2020-05-09 19:09:21
问题 What I want I'm trying to achieve the following user flow: User is browsing a webpage in iOS Safari. User selects some content (text and images) and waits for context menu to appear. User selects the "Share..." item. User selects my App Extension in the sharing menu that comes up from the bottom. Selected content and the webpage URL is shared to a remote server via an HTT call. What I tried I made a Share extension via Xcode. Here's the NSExtension section of my info.plist : <key>NSExtension<

How to Just launch app from share extension without post popup in Swift?

僤鯓⒐⒋嵵緔 提交于 2020-01-23 06:10:56
问题 I am a begginer in iOS app development and I would like to launch my app on copy link from another app. added shared extension on click it is displaying popup. But my requirement is it should not display popup and directly open my app on click of my shared extension. What I did: 1) Added rules in info.plist <dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>1</integer> </dict> Screen short : Please someone help me to fix this issue. Thanks Update : After adding below

Network request from share or action extension ios

若如初见. 提交于 2020-01-22 12:54:42
问题 I've searched around this title, but didn't find any appropriate information. I've found ways to make network request that sends it's result to containing app. However, I wanna get response directly back to extension and show information there. I've faced some ways to use javascript to access webpage, but there was nothing about making request to backend. Is it possible to make some request and get JSON response in action or share extension in iOS (iPhone, if matters)? Any info or guides will

swift share extension not sharing amzon item

耗尽温柔 提交于 2020-01-05 08:37:34
问题 in my app i integrated share extension. and i am able to get url when i am sharing safari page. but when i go on amazon site or app. and when i am tapping on share option of any product my share extension is not showing. Here is my info.plist <key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <string>TRUEPREDICATE</string> <key>NSExtensionJavaScriptPreprocessingFile</key> <string>GetURL</string> </dict> <key>NSExtensionMainStoryboard<

iOS Swift 3: Share Data from share extension to Host App

断了今生、忘了曾经 提交于 2019-12-24 10:56:06
问题 Hello i have implemented Share extension for my app in which picks images from gallery and send to a particular view. Now the problem is when i'm trying to save array of images(images picked from gallery) func manageImages() { let content = extensionContext!.inputItems[0] as! NSExtensionItem let contentType = kUTTypeImage as String for (index, attachment) in (content.attachments as! [NSItemProvider]).enumerated() { if attachment.hasItemConformingToTypeIdentifier(contentType) { attachment

iOS share extension not getting the image

孤人 提交于 2019-12-22 17:54:41
问题 I am sure this is trivial once someone kindly point me in the right direction so my apology for asking a silly question. However I have been searching for days I can't figure out what I am doing wrong. Scenario: create a simple share extension that receives an image file Problem: when I access the attachements, the handler is never called albeit I can see the "public.jpg" in the itemProvider but I can't see where the data would be? What I have done: 1) defined

iOS Share Extension not working after deploy

匆匆过客 提交于 2019-12-22 09:42:36
问题 I have created a Share extension which working fine while I am running it though xcode on device or simulator. But when I creating IPA or using TestFlight, it is not passing my list from host app to extension. I am creating this extension for posting an image in host app ( without uploading on server just in local sqlite ). For this I have checked, App Group and it is fine, cross checked the provisioning certificate and it is also attached with app group. If you have any idea please let me

How to Get the title in share extension view controller?

走远了吗. 提交于 2019-12-21 23:37:57
问题 -(void)viewDidLoad { [super viewDidLoad]; NSExtensionItem *item = self.extensionContext.inputItems[0]; NSItemProvider *itemProvider = item.attachments[0]; NSLog(@"%@",itemProvider); if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypePlainText]) { [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypePlainText options:nil completionHandler:^(NSString *item, NSError *error) { if (item) { textString=item; } }]; } I am using share extension in my app. I am using it as a