小编Ben*_*eah的帖子

使用自定义文件包UTI导出UIDocument

我正在尝试UIDocument使用a 导出我的子类UIDocumentPickerViewController.子类将数据写入a FileWrapper并且其UTI符合com.apple.package.

但是,所提供的文档选择器显示"iCloud Drive中的文档无法使用,因为iCloud Drive设置已禁用."

正如我从导出的容器包中看到的那样,文档已成功写入缓存.

缓存目录

当我更改文档子类和自定义UTI以符合单个文件(例如public.plain-text)时,文档选择器工作正常,我可以导出文件.所以问题似乎与文档类型或导出的UTI有关.

我做错了什么或这是一个错误?


的Info.plist

文档类型和导出的UTI

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>Custom Doc</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.zxzxlch.documentsandbox.customdoc</string>
        </array>
        <key>LSTypeIsPackage</key>
        <true/>
    </dict>
</array>

...

<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>com.apple.package</string>
        </array>
        <key>UTTypeDescription</key>
        <string>Custom Doc File</string>
        <key>UTTypeIdentifier</key>
        <string>com.zxzxlch.documentsandbox.customdoc</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>zzz</string>
            </array>
        </dict>
    </dict>
</array>
Run Code Online (Sandbox Code Playgroud)

CustomDocument.swift

private let textFilename = "contents.txt"

class CustomDocument: UIDocument {
    var content = "Test"

    override func load(fromContents contents: Any, …
Run Code Online (Sandbox Code Playgroud)

uti nsfilewrapper ios icloud uidocument

11
推荐指数
1
解决办法
959
查看次数

如何在不渲染的情况下从ERB代码块中产生?

考虑以下:

view.html.erb:

<%= make_backwards do %>
  stressed
<% end %>
Run Code Online (Sandbox Code Playgroud)

helper.rb:

def make_backwards
  yield.reverse
end
Run Code Online (Sandbox Code Playgroud)

视图呈现stresseddesserts而不是仅仅desserts.如何在yield不渲染代码块的情况下使用内容?

ruby ruby-on-rails erb

7
推荐指数
1
解决办法
752
查看次数

标签 统计

erb ×1

icloud ×1

ios ×1

nsfilewrapper ×1

ruby ×1

ruby-on-rails ×1

uidocument ×1

uti ×1