Parse.com Query with swift 1.2 and string array -


i trying query parse.com , db receiving 100 objects per time. used swift example code on website, , app doesn't build code. looked around , found people using code similar this:

 var query = pfquery(classname:"posts")     query.wherekey("post", equalto: "true")     query.findobjectsinbackgroundwithblock({ (objects: [anyobject]?, error: nserror?) -> void in         //           self.mydataarray = objects as! [string]      }) 

this not work, because trying convert pfobject string

i need 1 one value each object swift string array [string]. how 1 text value, instead of pfobject , how swift string array?

i don't speak swift well, problem code it's trying cast returned pfobject string, want extract string attribute, (if want it):

for object in objects {     var somestring = object.valueforkey("someattributename") string     self.mydataarray.addobject(somestring) } 

but please make sure need this. i've noticed lot of new parse/swift users (especially populating tables) have urge discard returned pfobjects in favor of 1 of attributes. consider keeping pfobjects , extracting attributes later need them. might find you'll need other attributes, too.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -