Reputation: 11
So I updated my Parse SDK to the latest version and Xcode shows a bug that previously was fine.
the bug is :
cannot invoke 'geoPointForCurrentLocationInBackground' with an argument list of type '((PFGeoPoint!, NSError!) -> Void)'
PFGeoPoint.geoPointForCurrentLocationInBackground {
(geoPoint:PFGeoPoint!, error: NSError!) -> Void in
if geoPoint != nil {
var geoPointLong = geoPoint.longitude
var geoPointLat = geoPoint.latitude
var currentLocation = PFGeoPoint(latitude: geoPointLat, longitude: geoPointLong)
var query = PFQuery(className: "posts")
query.orderByDescending("createdAt")
query.whereKey("postsLocation", nearGeoPoint: currentLocation, withinKilometers: 5.0 )
query.findObjectsInBackgroundWithBlock({
(objects: [AnyObject]!, error: NSError!) -> Void in
for object in objects {
self.jobPostedArray.addObject(object)
}
self.myTableView.reloadData()
self.refresher.endRefreshing()
})
}
}
Upvotes: 0
Views: 1068
Reputation: 9913
I think with the nullable annotation changes that have been made with v1.7.1 (?) of the Parse SDK the block parameters are no longer forced unwrapped - they're optional. If you change your block signature to:
PFGeoPoint.geoPointForCurrentLocationInBackground { (geoPoint: PFGeoPoint?, error: NSError?) -> Void in
...
}
it should work. Or, you could omit the types altogether because the compiler can infer them:
PFGeoPoint.geoPointForCurrentLocationInBackground { geoPoint, error in
...
}
Upvotes: 2