简体   繁体   English

如何在Swift中从库中查找复制文件的目录

[英]How to find directory of copied files from library in Swift

I'm trying to bundle a series of files from an imported library onto the simulator/iphone in Xcode 6.0, but I'm not quite sure how to find the directory these files are located in. 我正在尝试将一系列导入库中的文件捆绑到Xcode 6.0中的模拟器/ iphone上,但是我不确定如何找到这些文件所在的目录。

I still don't have enough reputation to post photos, but you can see how I'm attempting to copy the files over here: http://i.stack.imgur.com/RgFhH.png 我仍然没有足够的声誉来发布照片,但是您可以看到我如何尝试在此处复制文件: http : //i.stack.imgur.com/RgFhH.png

Ideally, I'm looking for function, in swift, that would return a string containing the directory path for these files. 理想情况下,我正在快速查找要返回包含这些文件的目录路径的字符串的函数。 I'm still new to programming in iOS so forgive me if I'm doing something incorrect or my terminology is off. 我对iOS编程还是很陌生,所以如果我做的不正确或我的术语不正确,请原谅我。

您可以使用NSBundle来获取资源的路径:

NSBundle.mainBundle().pathForResource("Name", ofType: "extension")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM