Post

Replies

Boosts

Views

Activity

NSPredicate: distanceToLocation:fromLocation:
This returns nothing even though there are multiple records in the radius. The field name of the location is Location.There is obviously code after this but that works fine it is just the predicate that doesn't work. let LocationOfUser = CLLocation(latitude: location.latitude, longitude: location.longitude) let fixedRadius = NSNumber(integerLiteral: 5000) let pred = NSPredicate(format: "distanceToLocation:fromLocation:(Location, %@) < %f", argumentArray: [LocationOfUser, fixedRadius]) let sort = NSSortDescriptor(key: "rating", ascending: true) let query = CKQuery(recordType: RecordType.Items, predicate: pred) query.sortDescriptors = [sort]
3
0
598
Apr ’20