即时通讯制作测验应用程序,我想从JSON文件中的服务器下载问题,解析它并制作问题对象,我将介绍它。我做到了,所以现在我想做出将创建JSON文件,并将其上传到服务器上的应用程序,我想它看起来像这样
以编程方式快速编写JSON文件
我会从文本字段中的所有信息,并将其保存在这样的JSON文件(与奥德值)
[
{
"question":"If you want to create a custom class which can be displayed on the view, you can subclass UIView.",
"answers":["True", "False"],
"correctIndex":0,
"module":3,
"lesson":0,
"feedback":"Subclassing UIView gives your class the methods and properties of a basic view which can be placed onto the view."
}
]
是在swift任何框架与我可以使用的功能? 或者我必须手动?如果手动如何保存JSON文件?
'JSONSerialization'数据! – luk2302
你应该看看SwiftyJSON(https://github.com/SwiftyJSON/SwiftyJSON) – mlidal
我认为这可能会帮助你:[http://stackoverflow.com/questions/28768015/how-to-save-an-array- as-a-json-file-in-swift](http://stackoverflow.com/questions/28768015/how-to-save-an-array-as-a-json-file-in-swift) – chengsam