How to declare vcard document type in xcode plist file - ios

I would like my App to open for VCards (.vcf format). I know that the type is known as public.vcard and has mime-type text/vcard.
How is this type registered in the info.plist?
I have declared many custom types (UTI) and that works for me, but the VCard is a known format and so far I did not manage to set it up. When I for example airdrop a vcf file, then iOS Contacts shows up, but not the "open with" dialog.
There is a similar question already, but the proposed solution does not work: https://stackoverflow.com/a/16506340/4180386

Some of the types handled by system apps that provide API access to the data (photos, contacts, calendars, etc) seem to only offer the system app as an airdrop destination. Other types work fine and result in the “open with” alert as you pointed out.

Related

iOS - How to send file from one app to other specific app

I want to send .pdf or image file from my app1 to app2 like instagram hooks. I don't want to show options. I want to send the file directly from app1 to app2 if app2 is installed.
At first I tried using custom URL schemes by modifiying this example. It is good for sending some strings but I couldn't find I way to send files with custom URLs. I've tried to encode file to base64 string and appending to URL. It didn't work. URL becomes broken.
Then I searched for implementing UIDocumentInteractionController Uti as Instagram and WhatsApp does. But I couldn't find any sufficient examples. This is the right way I guess but there isn't much information to go on.
How could I achieve this with the methods mentioned above? (App groups, keychain, pasteboard are not good options for me)
This is very old question, but I think, you tried to find something like this:
If you would like other applications to open your app based on a file type, you can register your document request in the application plist file. This provides a means to associate any file type with your iOS app.
Include the CFBundleDocumentTypes key, which is an array of dictionaries, where each entry defines information about the file type(s) your app supports.
Here are some useful links:
iOS Tips and Tricks: Associate a File Type with your App
How to register file types supported by an iOS app
How To Import and Export App Data Via Email in your iOS App

How to enable open of my own custom file type on iOS

I have an iOS app that I want to be able to send and receive instances of its own file type. The flow would be:
User 1 selects a Share function in the app. This generates a file of my type (say, file.myextension) and shares it using a UIActivityViewController. They send it somehow to User 2 (AirDrop, email, whatever).
User 2 receives the file and opens it. The system offers to open it using my app.
I've got the first part working. I can generate file.myExtension and give the UIActivityViewController a file URL to it. This shows up correctly in AirDrop on user 1's device, and I can transfer the file using AirDrop or email or whatever. But the receiving device refuses to show my app as an option to open the file.
I have tried:
Declaring Exported and Imported UTIs and a Document Type as per this Apple Q&A. I've triple-checked that all the IDs are the same and all the plist keys are spelled correctly.
I've tried both an Exported and Imported UTI alone (with a Document Type). This article seems to say that the Imported one is what I want if I want to open a file type. This SO answer says that registering a type I own and want to open means I just want Exported. Neither on its own worked.
My question: what do I have to do to be able to open a file extension that I own on iOS? Do I define both Imported and Exported UTIs, along with a Document Type? Just one of exported or imported? Any unexpected required attributes?
The CFBundleDocumentTypes key is what you need. It should be an Array, and each item in the array should be a Dictionary. Each Dictionary should contain the following keys:
CFBundleTypeIconFiles (Array of Strings)
CFBundleTypeName (String)
CFBundleTypeRole (String)
LSHandlerRank (String)
LSIsAppleDefaultForType (Boolean)
LSItemContentTypes (Array of Strings)
Here is what it looks like for my application (stuff blacked out to avoid revealing my company's identity):
Figured it out. One key detail not explicit in the docs is that the last part of the types in the Document Type section has to match the file extension you choose.

How to show all apps receives strings in "Open In.." menu?

I'm totally new in iOS development. I'm developing an app processing some strings in UItextview. After the process, I want show "Open In.." menu with all applications can receive text values.
To explain more. What I mean is like this in Android http://developer.android.com/training/sharing/send.html
I took a quick look at the link you posted.
Apple enforces a "sandbox" around apps which greatly limits what you can do.
Off the top of my head here are a few ways to do it:
Define a custom URL scheme in each of your apps. One app would open a URL using the other app's URL scheme, and that would open the other app and pass it the URL.
For a family of apps from the same company you should also be able to set up a common base "bundle ID" and use that to read and write shared entries to the keychain. The keychain is limited to fairly short bits of data however. (It's intended for password strings and the like.)
I haven't used it before, but you should also be able to use the UIDocumentInteractionController class to pass a copy of a document between apps. As I understand it, the sending app presents a document and asks the user to pick an app with which to open the document. When the user picks a target app, the system creates a copy of the document in the target app's documents directory and then tells the target app to open it.

Associate a file type to be opened in iPad/iPhone email attachment

I need to declare to any iOS 5 device that my application is able to open a specified file type format (e.g. a pdf, rtf, or jpg) file received as an attachment in an email. I read Apple documentation, and searched the web but couldn't obtained any result from all those tricks. Do you know any complete and efficient tutorial about declaring that ability of my application in a Xcode 4.3.x project? I just need that a user, when receiving an attachment, may be proposed either to preview the file or to open it in my application.
Thanks!
Denis

Is it possible to have access to the image specified in CFBundleURLIconFile via URL scheme from a different iOS app?

is it possible to access the icon specified with CFBundleURLIconFile in the info.plist file from a different application? Does application sandboxing prevent it? If so,what is the purpose of this key(in an iOS app of course)?
Thanks
As stated in CoreFoundationKeys docs: "CFBundleURLTypes contains an array of dictionaries, each of which describes the URL schemes (http, ftp, and so on) supported by the application. The purpose of this key is similar to that of “CFBundleDocumentTypes,” but it describes URL schemes instead of document types."
The purpose is to permit applications to register for some type of documents allowing an app to handle the opening of files from other installed app (you surely met the "Open In..." button, for example in Mail when you receive a file).
More on this in the Document Interaction Programming Topics for iOS.
EDIT:
Sorry, I forgot to answer to your main question: AFAIK the only way to access that key is through UIDocumentInteractionController.

Resources