3

我已阅读此内容:使用我的 ios 应用程序打开文本文件,这很棒,因为它允许我将我的应用程序视为打开它的选项之一,并且在选择我的应用程序时它会打开我的应用程序,仅此而已。有两个问题:

首先,虽然“打开”例如Google驱动器说“复制到驱动器”,而我的说“复制到(null)”当我想要它说“复制到HotSpotRIS”时。我怎样才能做到这一点?至少显示了应用程序图标。如果有帮助,我的整个项目的整体包标识符是 www.epicode.com.HotSpotRIS。这是三张图片,向您展示了我在具体谈论的内容,第一张图片向您展示了通过电子邮件发送的 txt,第二张是用户按住 txt 文件,第三张是由此弹出的“打开方式”菜单我的应用阅读“复制到(空)”:

在此处输入图像描述在此处输入图像描述在此处输入图像描述

其次,我知道如何读取和写入文本文件以及如何导航 iOS 文件系统,但是如何将我的代码连接到 .plist 文件以读取通过电子邮件发送的 txt 文件?我猜需要有一些标识符,然后我可以使用它来调用以获取 txt 数据。到目前为止,这是我的 info.plist 文件,文件的最后一位是我使用 ios 应用程序从打开的文本文件中获得的代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>CFBundleGetInfoString</key>
    <string></string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>NSLocationWhenInUseUsage</string>
    <key>LSApplicationCategoryType</key>
    <string></string>
    <key>CFBundleDisplayName</key>
    <string></string>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>Text File</string>
            <key>CFBundleTypeRole</key>
            <string>Viewer</string>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>txt</string>
                <string>TXT</string>
            </array>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>www.epicode.com.HotSpotRIS.txt</string>
            </array>
        </dict>
    </array>
    <key>UTExportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.text</string>
            </array>
            <key>UTTypeDescription</key>
            <string>Plain Text Document</string>
            <key>UTTypeIdentifier</key>
            <string>www.epicode.com.HotSpotRIS.txt</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>public.filename-extension</key>
                <string>txt</string>
                <key>public.mime-type</key>
                <string>text/plain</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

先感谢您!

4

0 回答 0