maplibre-native: NSExpression function is forbidden

I’ve started getting an error log on device when using iOS 15.5. I’m not sure if it would happen in simulator since Maplibre currently crashes for iOS 15.

Xcode 13.4

2022-06-06 11:34:47.472457-0700 Lyft[42141:5886591] [general] NSPredicate: Use of 'mgl_interpolate:withCurveType:parameters:stops:' as an NSExpression function is forbidden.

I tried to look around at things in terms of how we use this Expression in our codebase. We basically use: mgl_interpolate:withCurveType:parameters:stops:($lineProgress, 'linear', nil, %@)

I was able to find some things online that said you can wrap the function here https://github.com/mapbox/mapbox-gl-native-ios/issues/271

So I tried that by doing (mgl_interpolate:withCurveType:parameters:stops:($lineProgress, 'linear', nil, %@)) but it still issues errors.

I also tried to migrate to use the NSExpression conveniences from Maplibre. But I still get errors issues from those, so it seems they are also mis-formatted (?).

This is definitely polluting the logs but I am worried that somehow this will not be supported in the future by Apple. I think I was also getting some failures in my tests because it caused an unhandled exception.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 25 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks, I think Apple ‘nerfed’ NSExpressions, and that is why we are seeing these problems.

I will look into this a bit, but we may have to design another API and drop the NSExpression wrappers altogether (see https://github.com/maplibre/maplibre-native/issues/1820).

How would one use this syntax with feature attributes? In the diffs, it looks like the magnitude attribute was mistakenly replaced with .zoomLevelVariable: https://github.com/maplibre/maplibre-gl-native/pull/411/files#diff-497e9b9ec44106c19f48191690d47af4a33123966eae167946b2eb81523deeb2