Xcode 11 iOS操场不再符号链接操场SharedDataDirectory-错误或功能?

Xcode 11 Playgrounds似乎改变了 import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyClass { private static final Logger LOGGER = LoggerFactory.getLogger(MyClass.class); private Map<String,Integer> data = new HashMap<>(); public void myHandler() { data = new HashMap<>(); LOGGER.info("Refreshed cache "); } } 的行为:

要进行复制,请将以下内容粘贴到操场上并分别在Xcode 10和Xcode 11中执行:

playgroundSharedDataDirectory

import PlaygroundSupport print(playgroundSharedDataDirectory) let str = try String(contentsof: playgroundSharedDataDirectory.appendingPathComponent("data.json")) // assuming you create ~/Documents/Shared Playground Data/data.json 解析为:

Xcode 11.2:

  • iOS:playgroundSharedDataDirectory
  • macOS:file:///Users/:username/library/Developer/XCPGDevices/DB897D66-E542-44BD-B6CF-0176A3E480A9/data/Containers/Data/Application/2F952093-BD81-4B0C-AD45-8B5E45B4D7AB/Documents/Shared%20Playground%20Data/

Xcode 10.2.1:

  • iOS:file:///Users/:username/Documents/Shared%20Playground%20Data/
  • macOS:file:///var/folders/s7/x9ltynsn2zg_djfbtzszhn8d4zn6gb/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.MyPlayground-5985DF99-2BFE-45AC-9F34-70620F1DCD17/Documents/Shared%20Playground%20Data/

在Xcode 10.2.1中,iOS游乐场符号链接到file:///Users/:username/Documents/Shared%20Playground%20Data/,而在Xcode 11+中不再使用。

我想知道,这是有意改变吗?如果是这样,如何从iOS游乐场访问共享文件?

PS:我看到了一个相关问题的答案(请参阅https://stackoverflow.com/a/57981133/1324861),但是,如果我正在运行的代码需要iOS游乐场,则该答案实际上并不适用。

oyming86 回答:Xcode 11 iOS操场不再符号链接操场SharedDataDirectory-错误或功能?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3143985.html

大家都在问