mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '“ANY” or “SOME” is only supported for the “=” operator.' #16515

Open ThiyagarajanShivSankaran opened 3 years ago

ThiyagarajanShivSankaran commented 3 years ago

HI, We recently updated MapBox SDK from 5.5.0 to 5.9.0 and found a crashing issue.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '“ANY” or “SOME” is only supported for the “=” operator.'

Below is the query we are converting into predication expressions.

let predicate = NSPredicate(format: "ANY hoursdetail.jobcode IN  { 'Sick', 'Vacation' }")
if let expressionObject = predicate.mgl_jsonExpressionObject as? NSArray {
   print(expressionObject) 
}

And, Here is the data1,

{
"class": "job",
"datecreated": "2020-07-19 08:00:00",
"hoursdetail": [
{
          "comment": " ",
          "company": "",
          "jobcode": "Sick",
          "workedhours": 32400
        },
{
          "comment": " ",
          "company": "",
          "jobcode": "Wielding",
          "workedhours": 32400
        }
]
}

Data 2,

{
"class": "job",
"datecreated": "2020-07-18 08:00:00",
"hoursdetail": [
{
          "comment": " ",
          "company": "",
          "jobcode": "Vacation",
          "workedhours": 32400
        },
{
          "comment": " ",
          "company": "",
          "jobcode": "Plumbing",
          "workedhours": 32400
        },
{
          "comment": " ",
          "company": "",
          "jobcode": "Wielding",
          "workedhours": 32400
        }
]
}

We need to filter the data where any of the 'jobcode' is 'sick' or 'vacation'. But, it's crashing with the new SDK. This is very critical issue for us. Please, reply me immediately.

Mapbox SDK versions: 5.9.0 iOS/macOS versions: 13.6 Device/simulator models: All Devices Xcode version: 11.6