Registering your app with iOS will use the features in the iOS documentation, and we'll register our program to handle our own special document types.
First, we'll set up document types in the Info.plist file.
<key>CFBundleDocumentTypes</key><array><dict><key>CFBundleTypeName</key> <string>myapp</string><key>LSHandlerRank</key><string>Default</string>< Key>lsitemcontenttypes</key><array><string>com.customapp.myapp</string></array ></dict></array>
Property Description:
Cfbundletypename: Document type name, here I will share the file compression package into *.myapp format
Lshandlerrank: This refers to whether you have a subdocument, and here I set the default
Lsitemcontenttypes: Fill in your app's bundle identifier here
Then we define the UTI:
<key>utexportedtypedeclarations</key><array><dict><key>uttypeconformsto</key ><array><string></string></array><key>uttypeidentifier</key><string >com.customApp.myApp</string><key>UTTypeTagSpecification</key><dict><key> Public.filename-extension</key><string>myapp</string></dict></dict></array >
Uttypeidentifier: Fill in your app'sBundle Identifier
Public.filename-extension: Fill in the extension of your compressed package here.
OK, now our app will appear in the list of open ways. Know how to register, then how to handle the obtained file? Quite simply, in the -application:didfinishlaunchingwithoptions: method, add the following code:
Nsurl *url = (Nsurl *) [launchoptions Valueforkey:uiapplicationlaunchoptionsurlkey];
This URL is the URL to the file you received. Now you can easily handle your own custom type files in your own app.
Resources:
Email Tutorial for Ios:how to Import and Export app Data Via Mail in your IOS app
How does I associate file types with an IPhone application?
Sign up for your app to iOS