swift - Assigning a value to an object of type AnyObject -


i have variable

var post :anyobject? 

which object got parse api call. want

post["caption"]  = captiontextview.text 

but following error message

cannot subscript value of type 'anyobject?' index of type 'string'

i figured out how value post variable. example, works fine extract value key "caption"

captiontextview.text = post!["caption"] as! string! 

but don't know how change value. want change value of post variable , save can updated parse database. what's correct way this?

are sure don't want use pfobject class instead of anyobject?

var post :pfobject? post?["caption"]  = captiontextview.text 

https://www.parse.com/apps/quickstart#parse_data/mobile/ios/swift/existing


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -