Ios 如何访问RubyMoon代码中的resources文件夹中的文件?

Ios 如何访问RubyMoon代码中的resources文件夹中的文件?,ios,rubymotion,Ios,Rubymotion,我的RubyMoon项目的资源/文件夹中有一些数据文件。如何在代码中访问它们?没有路径访问它们是不起作用的 e、 g。 我在resources/中有一个名为schema.json的文件 以下是我正在使用的代码: NSData.dataWithContentsOfFile("schema.json") <--- returns nil NSData.dataWithContentsOfFile(“schema.json”)解决了这个问题 path = NSBundle.mainBundle

我的RubyMoon项目的资源/文件夹中有一些数据文件。如何在代码中访问它们?没有路径访问它们是不起作用的

e、 g。 我在resources/中有一个名为schema.json的文件

以下是我正在使用的代码:

NSData.dataWithContentsOfFile("schema.json") <--- returns nil
NSData.dataWithContentsOfFile(“schema.json”)解决了这个问题

path = NSBundle.mainBundle.pathForResource("schema", ofType:"json")
NSData.dataWithContentsOfFile(path)

之后,您如何查询它?如何将其存储到哈希中?可以使用JSON解析器。我使用BubbleWrap()