ios - Get fields from NSArray with CoreData content -
i have table in core data fields, can count of records, can´t values each field, have code:
var request:nsfetchrequest = nsfetchrequest(entityname: "radar") //my table in core data let appdelegate:appdelegate = (uiapplication.sharedapplication().delegate as! appdelegate) let context:nsmanagedobjectcontext = appdelegate.managedobjectcontext! request.returnsobjectsasfaults = false var results:nsarray = context.executefetchrequest(request, error: nil)! println(results.count) //this count can
i need more, radar have fields: descr,latit,long need fields create annotation this: results.descr
you need loop array of results , cast each result nsmanagedobject
retrieved, in case radar
if results.count > 0 { result in results { if let r = result as? radar{ //now can access properties of radar in r println(r.descr) } else{ println("could not cast fetch result radar") } } }
Comments
Post a Comment