xcode - Post expiration time with Swift in iOS 8? -
users can post pin on map @ location, once post pin set on map forever user post. set time expiration on these posts, after 24 hours post wiped , gone. i'm not sure if parse thing or if part of xcode?
here add pins:
var annotationquery = pfquery(classname: "post") currentloc = pfgeopoint(location: mapviewlocationmanager.location) //annotationquery.wherekey("location", neargeopoint: currentloc, withinmiles: 10) annotationquery.wherekeyexists("location") annotationquery.findobjectsinbackgroundwithblock { (points, error) -> void in if error == nil { // find succeeded. println("successful query annotations") // found objects let myposts = points as! [pfobject] post in myposts { let point = post["location"] as! pfgeopoint let annotation = mkpointannotation() annotation.coordinate = cllocationcoordinate2dmake(point.latitude, point.longitude) annotation.title = post["title"] as! string! let annotationsubtitleuser = post["username"] as! string! let formatter = nsdateformatter() formatter.datestyle = nsdateformatterstyle.shortstyle formatter.timestyle = .shortstyle let datestring = formatter.stringfromdate(post.createdat!) annotation.subtitle = "user: \(annotationsubtitleuser) time: \(datestring)" self.mapview.addannotation(annotation) } } else { // log details of failure println("error: \(error)") } }
thank in advance!
Comments
Post a Comment