Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not convert return expression of type '[UIView : ViewAnnotationOptions]' to return type 'Dictionary<String, Optional<JSONValue>>.RawValue' (aka 'Dictionary<String, Optional<Any>>') #3738

Open
matiastang opened this issue Jan 13, 2025 · 1 comment

Comments

@matiastang
Copy link

Environment

  • Dev OS: [e.g. OSX 15.1.1]
  • Xcode: [Version 16.2 ]
  • @rnmapbox/maps version: [eg. 10.1.33]
  • React Native version: [eg. 0.76.3]
  • Expo version: [eg. 52.0.7]

Steps to reproduce

If the build in Xcode or Expo fails and shows the following error: Cannot convert return expression of type '[UIView : ViewAnnotationOptions]' to return type 'Dictionary<String, Optional>.RawValue' (aka 'Dictionary<String, Optional>')

The error originates from lines 76-82 in the Pods->MapboxMaps->ViewAnnotationManager file.

/// The complete list of annotations associated with the receiver.
@available(*, deprecated, message: "Use ViewAnnotation")
public var annotations: [UIView: ViewAnnotationOptions] {
    idsByView.compactMapValues { [mapboxMap] id in
        try? mapboxMap.options(forViewAnnotationWithId: id)
    }
}

It’s just a type error, and I bypassed this error using the following method.

/// The complete list of annotations associated with the receiver.
@available(*, deprecated, message: "Use ViewAnnotation")
public var annotations: [UIView: ViewAnnotationOptions] {
    return [:]
}

The annotations property has been deprecated, which might be an issue with the mapbox-gl version.

@Roshdy
Copy link

Roshdy commented Jan 13, 2025

facing the same problem using rn 0.76.6

bypassing by using the code from mapbox-maps-ios

    /// The complete list of annotations associated with the receiver.
    @available(*, deprecated, message: "Use ViewAnnotation")
    public var annotations: [UIView: ViewAnnotationOptions] {
        let values = idsByView.compactMapValues { [mapboxMap] id in
            try? mapboxMap.options(forViewAnnotationWithId: id)
        }
        return values
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants