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

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -