ios - How to download my object? (issue with optionals in old Xcode version) -


since developed app xcode 6.2, found problems, many solved, one, maybe requires rebuild app again. in code below, filterbyproximity function gives error. suppose matter of optionals (nils ziehn warned me here it). developer told me: "download position object using cache, , make query".

well, possible? how can it? here code:

import uikit import mapkit import corelocation  class mapviewcontroller: uiviewcontroller, cllocationmanagerdelegate {       @iboutlet weak var mapview: mkmapview!      override func viewdidload() {         super.viewdidload()          // additional setup after loading view.          var locationmanager = cllocationmanager()          var lat = locationmanager.location.coordinate.latitude         var lon = locationmanager.location.coordinate.longitude          let location = cllocationcoordinate2d(latitude: lat, longitude: lon)         let span = mkcoordinatespanmake(0.05, 0.05)         let region = mkcoordinateregionmake(location, span)         mapview.setregion(region, animated: true)          let anotation = mkpointannotation()         anotation.setcoordinate(location)         anotation.title = "my title"         anotation.subtitle = " subtitle"          mapview.addannotation(anotation)          println("****** welcome in mapviewcontroller")            //mark: (471) crossing positions         //*******************************************************          let mygeopoint = pfgeopoint(latitude: lat, longitude:lon)         let myparseid = pfuser.currentuser().objectid //pfuser.currentuser().objectid          println("****** geopoint map view controller: \(mygeopoint)")   //         //        var inspector = pfquery(classname:"gamescore") //                inspector.saveinbackgroundwithblock { //                    (success: bool, error: nserror?) -> void in //                    if (success) { //                        // object has been saved. //                        var = inspector.objectid //                    } else { //                        // there problem, check error.description //                    } //                } //         //         //                  //mark: *** let's other users ***  //        func filterbyproximity() { //            pfquery(classname: "position") //                .wherekey("where", neargeopoint: mygeopoint, withinkilometers: 500.0)     //(474) //            .findobjectsinbackgroundwithblock ({ //                objects, error in //                if let proximityarray = objects as? [pfobject] { //                    println("****** here proximity matches: \(proximityarray)") //                    near in proximityarray { //                        println("here \(near)") //                      //                        let position = near["where"] as? pfgeopoint //                     ////                        if let position = near["where"] as! pfgeopoint { ////                            let theirlat = position.latitude ////                            let theirlon = position.longitude ////                        } //                         //                            let theirlat = near["where"].latitude double //                            let theirlong = near["where"].longitude double //                            let location = cllocationcoordinate2dmake(theirlat, theirlong) //                            let span = mkcoordinatespanmake(0.05, 0.05) //                            let region = mkcoordinateregionmake(location, span) //                            self.mapview.setregion(region, animated: true) //                            let theiranotation = mkpointannotation() //                            theiranotation.setcoordinate(location) //                            self.mapview.addannotation(anotation) // // //                    } //                } //            }) //        } //         //        filterbyproximity()   //        //mark: *** let's update position (on parse) *** //         //        func exists() { //        pfquery(classname:"position") //            .wherekey("who", containsstring: myparseid) //            .findobjectsinbackgroundwithblock({ //            thisobject, error in //                if let result = thisobject as? [pfobject] { //                    println("here result: \(result)") //                     //                    let gottheid = result[0].objectid //                    println("ecco l'id singolo \(gottheid)") // //                            //******** update function ******** //                            var query = pfquery(classname:"position") //                            query.getobjectinbackgroundwithid(gottheid) { //                                (usingobject: pfobject?, error: nserror?) -> void in //                                if error != nil { //                                    println(error) //                                } else if let objecttoupdate = usingobject { //                                    println("else occurred") //                                    objecttoupdate["where"] = mygeopoint //                                    println("position should updated") //                                    objecttoupdate.saveinbackgroundwithblock(nil) //                                    println("position should saved") // //                                } //                            } //                            //******** end update function ******** //                } //            }) //        } //         //        exists()          //*******************************************************         }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }    } 


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -