Reputation: 207
I am new to iOS development. I designed a custom attachment to send through mail. When I receive the attachment in mail, I want to open the attachment in my app. Here is my info.plist
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>pvt file</string>
<key>UTTypeIdentifier</key>
<string>com.pryvateBeta.crypt.pvt</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pvt</string>
</dict>
</dict>
</array>
<key>CFBundleDocumentsType</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>pvt file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.pryvateBeta.crypt.pvt</string>
</array>
</dict>
</array>
And here is my Appdelegate
func application(application: UIApplication, openURL Url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
let encrypteddata = NSData(contentsOfURL: Url)
return true
}
I have asked the question before in this LINK. It was a possible duplicate of this QUESTION. But, I didn't get the solution and could not find where the problem is.
What is missing in my code? Any help is appreciated
Upvotes: 1
Views: 2569
Reputation: 1192
try this. i copy and pasted ur code in my plist and its not working. then i created another plist and its code is as below. and its working
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>LSItemContentTypes</key>
<array>
<string>com.pryvateBeta.crypt.pvt</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeName</key>
<string>pvt file</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.pryvateBeta.crypt.pvt</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.mime-type</key>
<string>application/pry</string>
<key>public.filename-extension</key>
<string>pvt</string>
</dict>
</dict>
</array>
Upvotes: 5