如何在解析中将数据保存到用户? [英] How can i save Data to a User in Parse?

查看:72
本文介绍了如何在解析中将数据保存到用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想备份UITableView的数据以进行解析.首先,用户登录.现在,每个用户都应该拥有自己的UITableView的云存储保存,但是如何在按下按钮(保存)时上载此UITableView或UITableViewCell?

I want to backup the Data of an UITableView to Parse. First the User logs in. Now every user should have it's own cloud Storage save of their UITableView, but how to upload this UITableView or the UITableViewCell when pressing on a Button (Save)?

推荐答案

您可以创建单独的Model对象,以填充 UITableView 的每个单元格. 文档:

You can create separate Model objects for populating each cell of the UITableView . Saving objects into parse is very well in explained in the documentation:

如果您仍然需要更多说明,也请看一下本教程: 教程

Also take a look at this tutorial if you still need more explanation: Tutorial

Parse只是一个backend,它使您可以通过调用函数来保存数据. 解析的概念是通过使用应用程序的api和数据库来显示应用程序中的数据.

Parse is just a backend which allows you to save data by calling their functions. The concept of parse is to show the data in your app by using their api and database.

在解析数据库中保存PFObject(解析对象)的示例:

An example to save a PFObject (A parse object) in the parse database:

let testObject = PFObject(className: "TestObject") // Create the PFObject with the classname/tablename on parse
testObject["foo"] = "bar" // set the property "foo" to "bar"
// save the object in background (not on the gui thread to prevent lags on the UI)
testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
  println("Object has been saved.")
}

注意:在调用这些函数并创建对象之前,您需要导入解析库并初始化要解析的应用.

ATTENTION: Before to be able to call these functions and create there objects you need to import the Parse Library and initialize your app to parse.

这篇关于如何在解析中将数据保存到用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆