使用我的swift2 iOS应用

时间:2016-09-16 09:37:35

标签: ios swift2 plist identifier open-with

我已经读过这个:open text files with my ios app并且它很棒,因为它允许我将我的应用视为打开它的选项之一,当选择我的应用程序时它会打开我的应用程序,但就是这样。有两个问题:

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

enter image description here enter image description here enter image description here

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

<?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>

提前谢谢!

0 个答案:

没有答案