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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -