Reputation:
my english is not the best and i even don't know how to search for it so i have to describe my question. I am programming (in Swift 2) an app playing music. Everything is working. Shared iTunes folder, choosing a file and open it. But how can i open/import a file from an other app? lets say i've downloaded a mp3 file in Safari and want to open it in my own app by clicking this little "open in" button. How can i add my app to this "open in dialogue"? (I want to import it to my shared iTunes folder) A link to a tutorial or sth. would be nice.
Upvotes: 1
Views: 2532
Reputation: 2824
To declare its support for file types, your app must include the CFBundleDocumentTypes key in its Info.plistproperty list file.
The CFBundleDocumentTypes key contains an array of dictionaries, each of which identifies information about a specific document type. A document type usually has a one-to-one correspondence with a particular file type. However, if your app treats more than one file type the same way, you can group those file types together to be treated by your app as a single document type. For example, if you have an old and new file format for your application’s native document type, you could group both together in a single document type entry. This way, old and new files would appear to be the same document type and would be treated the same way.
<dict>
<key>CFBundleTypeName</key>
<string>My File Format</string>
<key>CFBundleTypeIconFiles</key>
<array>
<string>MySmallIcon.png</string>
<string>MyLargeIcon.png</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>com.example.myformat</string>
</array>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
This page from the Apple doc should help you, https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1
Upvotes: 1