Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to associate CSV file to my app in iOS 7

Tags:

ios

csv

plist

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>
like image 921
Joe Avatar asked Apr 09 '14 15:04

Joe


People also ask

How do I import contacts from CSV to iPhone?

Select the group iCloud and then click Import in the toolbar. Select the CSV file that contains the contacts you want to import to iPhone and click Open. Once the changes are synced to iPhone, you can successfully import CSV contacts to your iPhone.

What is CSV file on iPhone?

The CSV (comma-separated values) format is easily recognized by many contact management programs. To import contact data from a CSV file to your iPhone, you must first import the data from the CSV file to a contact management program that is compatible with the iPhone.


1 Answers

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>
like image 189
NSGod Avatar answered Oct 05 '22 13:10

NSGod