简体   繁体   中英

Open file with App on iOS Simulator?

How do I open a file (it's an XML file) with the iOS app I'm developing. I want to test my: UIApplicationLaunchOptionsURLKey implementation. How do I do this? iOS Simulator doesn't come with Mail or anything so I'm clueless as to testing that kind of a function. Any ideas?

I did Document Types under Xcode's Target Properties bit so I'm pretty sure that's right:

<dict>
    <key>CFBundleTypeIconFiles</key>
    <array>
        <string>icon</string>
    </array>
    <key>CFBundleTypeName</key>
    <string>XML File</string>
    <key>LSItemContentTypes</key>
    <array>
        <string>public.XML</string>
    </array>
</dict>

You simply have to drag and drop your file on the simulator. If your app registers for that file type, your app will open and handle it.

使用Apple的示例应用程序 ,您可以在此应用程序中包含您的文件,它将让您“打开”,您可以选择您的应用程序。

You want something that looks like this:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>XML File</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.xml</string>
        </array>
    </dict>
</array>

This should be one entry in the Info.plist file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM