ios - Save data from parse into a string -
i want save data parse class strings. use following code retrieving data parse class.
@ibaction func readaction(sender: uibutton) { var tagautor = "" var tagtext = "" var query = pfquery(classname:"tags") query.getobjectinbackgroundwithid("f3axazt9jo") { (tag: pfobject?, error: nserror?) -> void in if error == nil && tag != nil { println(tag) // tagautor = tag["username"] // tagtext = tag["tagtext"] } else { println(error) } } }
in comments there want do, in class called "tags" there 2 cols called "username" , "tagtext" want save them in 2 string variables "tagautor" , "tagtext". println(tag)
printing out following:
how can save objects out of query 2 string variables?
tell compiler convert anyobject
string
:
if let author = tag["username"] string { tagautor = author }
and move definition of tagauthor
can use outside function
Comments
Post a Comment