Xcode Playgrounds Shared Directory Not Working

自古美人都是妖i 提交于 2019-12-11 07:38:39

问题


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

Expected: ~/Documents/Shared Playground Data

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)

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, also appears in Xcode 11. This worked in 10.2


回答1:


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



来源:https://stackoverflow.com/questions/57980951/xcode-playgrounds-shared-directory-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!