Description
As of iOS 11.4 and macOS 10.15.4, if an “aftermarket” expression function like the ones added in mapbox/mapbox-gl-native#11472 appears at the top level of an NSExpression format string, it may raise an “Unable to parse the format string” exception unless certain syntaxes are used to make it an explicit function call. For example:
mgl_round(3.14159)
💥mgl_round:(3.14159)
✔️(mgl_round(3.14159))
✔️mgl_round(3.14159) + 0
✔️abs(mgl_round(3.14159))
✔️
This issue affects any of the functions installed by +[MGLAftermarketExpressionInstaller installFunctions]
:
mapbox-gl-native-ios/platform/darwin/src/NSExpression+MGLAdditions.mm
Lines 65 to 88 in 23b5b46
I suspect this regression is caused by a change in Apple’s iOS/macOS SDK, not the Mapbox Maps SDK. It’s possible that one of these private methods is responsible for raising the error. However, there probably isn’t much we can do about this issue, because we’re trying to avoid any potential App Store submission issues that would arise from calling any private method. We’re only extending the _NSPredicateUtilities
class, which we’re only obtaining indirectly using official documented APIs.
In the absence of a fix, we should document this edge case in the “Predicates and Expressions” guide.
/cc @mapbox/maps-ios