Skip to content

App Crash Due to Duplicate ‘MapItemController’ Keys in Dictionary on Location Search #13

@vicvoh

Description

@vicvoh

This issue is a bug related to duplicate 'MapItemController' keys causing a crash.

Summary:

The app crashes when searching for a location. After the search, two duplicate entries for the same location appear, leading to a fatal error and crash. The error message in the console indicates that there are duplicate keys of type ‘MapItemController’ found in a Dictionary.

Steps to Reproduce:

1.	Open the MapItemPicker app.
2.	Search for a location.
3.	Notice that two identical entries for the same place appear in the search results.
4.	The app crashes immediately with the following error message:

Error Message:

Thread 1: Fatal error: Duplicate keys of type 'MapItemController' were found in a Dictionary.
Inside the public extension Array, SchafKit

Image

Expected Behavior:

Only one entry for each location should appear in the search results, and the app should handle duplicate entries gracefully without crashing.

Actual Behavior:

When two duplicate locations are found, the app crashes with the fatal error described above.

Error Stack Trace:

Thread 1: Fatal error: Duplicate keys of type 'MapItemController' were found in a Dictionary.

Environment:

•	Device: [iPhone 13 Pro Max]
•	iOS Version: [iOS 18.4 Dev Beta 2]
•	Xcode Version: [16]

Additional Information:

•	The issue seems to occur when the app attempts to display multiple identical results for the same location.
•	This issue may be related to how the app handles or stores search results in a dictionary, where duplicate keys are being added.
•	The error occurs inside a SwiftUI Array extension.

Suggested Fix:

Consider adding a check before adding new items to the dictionary to ensure there are no duplicates, or switch to a collection type that prevents duplicates, such as a Set. Alternatively, improve the handling of MapItemController keys to ensure they are unique when added to a dictionary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions