Xcode Playgrounds 共享目录不起作用 [英] Xcode Playgrounds Shared Directory Not Working

查看:36
本文介绍了Xcode Playgrounds 共享目录不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建 Xcode Playground 时,支持的 playgroundSharedDataDirectory 没有正确显示我的预期目录.

When creating an Xcode Playground, the supported playgroundSharedDataDirectory does not properly show my the expected directory.

预期:~/Documents/Shared Playground Data

Expected: ~/Documents/Shared Playground Data

实际:file:///var/folders/46/zg_mg07d5h5_9t6q_4vr9_2w0000gn/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.MyPlayground-BEF99F13E-BEF99F13E-45C9-A18E-7DE953069D69/Documents/Shared%20Playground%20Data/

Actual: file:///var/folders/46/zg_mg07d5h5_9t6q_4vr9_2w0000gn/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.MyPlayground-BEF6F13E-994E-45C9-A18E-7DE953069D69/Documents/Shared%20Playground%20Data/

import UIKit
import PlaygroundSupport

print(playgroundSharedDataDirectory)

这也没有链接到目录.如果我将文件放在正确的目录中,则无法读取它.如果我将它放在目录中,它确实可以工作,但是每次加载 Playground 时它都会改变.

This also does not link to the directory. If I place a file in the correct directory, I cannot read it. If I place it in the directory, it does work, but it changes every time the playground is loaded.

Xcode 10.3,也出现在 Xcode 11 中.这在 10.2 中有效

Xcode 10.3, also appears in Xcode 11. This worked in 10.2

推荐答案

这就是 iOS Playground 使用的路径.如果您制作 macOS 游乐场,它将具有路径 ~/Documents/Shared Playground Data

That's the path that iOS playground use. If you make a macOS playground it will have the path ~/Documents/Shared Playground Data

这篇关于Xcode Playgrounds 共享目录不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆