1

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

Community
  • 1
  • 1
Mohammed Janish
  • 207
  • 4
  • 17
  • Use the Info tab of the app target editor to set up your document types and exported UTIs. It will set up the Info.plist properly. – matt Aug 19 '15 at 04:07
  • Is there anything missing in the plist? So that i could add it in the way you mentioned @matt – Mohammed Janish Aug 19 '15 at 04:19

1 Answers1

5

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>
Shebin Koshy
  • 1,182
  • 8
  • 22