How to associate CSV file to my app in iOS 7
Asked Answered
G

1

8

Good day, everyone.

I followed these two tutorials line by line, try to associate my app to the csv file (email app attachment), but I after I added these down below changes to my app's plist file, then build my app and run it my device (iPhone 4, iOS 7.0.4), nothing happens, I mean when I clicked on the .csv file in the email, my app still does not show up in the open-in available application list, I just don't know where I did wrong, or iOS 7 has different way doing this?

http://blog.spritebandits.com/2011/12/14/importing-csv-data-file-into-an-ios-app-via-email-attachment/

http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app

this is what my plist changes (the new entries added followed by the tutorial) looks like:

enter image description here

here's the app setting screen:

enter image description here

and here's the xml version:

        <key>CFBundleDocumentTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeName</key>
                <string>CSV Document</string>
                <key>LSHandlerRank</key>
                <string>Owner</string>
                <key>CFBundleTypeRole</key>
                <string>Viewer</string>
                <key>LSItemContentTypes</key>
                <array>
                    <string></string>
                </array>
            </dict>
        </array>
        <key>UTExportedTypeDeclarations</key>
        <array>
            <dict>
                <key>UTTypeDescription</key>
                <string>CSV Document</string>
                <key>UTTypeConformsTo</key>
                <array>
                    <string>public.data</string>
                </array>
                <key>UTTypeIdentifier</key>
                <string>Damian-s.${PRODUCT_NAME:rfc1034identifier}</string>
                <key>UTTypeTagSpecification</key>
                <dict>
                    <key>public.filename-extension</key>
                    <string>csv</string>
                    <key>public.mime-type</key>
                    <string>application/inventorytodo</string>
                </dict>
            </dict>
        </array>
Gamely answered 9/4, 2014 at 15:19 Comment(2)
What tutorials are you referring to?Encompass
sorry 68cherries, I missed it, I've just added them to the questionGamely
G
9

You're missing the UTI type in your CFBundleDocumentTypes definition:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>CSV Document</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string></string>
        </array>
    </dict>
</array>

should be:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>CSV Document</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>Damian-s.${PRODUCT_NAME:rfc1034identifier}</string>
        </array>
    </dict>
</array>
Garnet answered 9/4, 2014 at 16:35 Comment(2)
NSGod! OMG, you rock!Gamely
I tried this on iOS 12 and is working fine. But not working with iOS 13. The app does not appear in the list shown on tapping "Share File via...". Am I missing anything?Daedal

© 2022 - 2024 — McMap. All rights reserved.