我使用服务器端的斯威夫特,做后做我的Xcode开发:服务器端斯威夫特:测试代码,使用捆绑
swift package generate-xcodeproj
我有一个使用Bundle
(以前NSBundle
)一类加载.plist文件中的服务器中的一些设置。它在服务器本身运行时工作正常,但是当我为这个类创建一些单元测试时,我无法访问.plist文件所在的目录。代码的相关片段是:
let bundlePath = Bundle.main.bundlePath as NSString
let plistPath = bundlePath.appendingPathComponent("Test.plist")
plistDict = NSDictionary(contentsOfFile: plistPath)
当我在单位XCTests运行此,plistPath是:
/Applications/Xcode-8.2.app/Contents/Developer/Platforms/MacOSX.platform/ Developer/Library/Xcode/Agents/Test.plist
这不是很有用。
我注意到的一件事是没有“常规”选项卡下的“主机应用程序:”的选项。
想法?