Hi Scott,
I created a unit test now as well, like this:
/// https://feedbackassistant.apple.com/feedback/13181573
- (void)testTypes {
NSDictionary<NSNumber*, WaypointType*> *types = @{
[NSNumber numberWithInt:-2]:[[CircleWaypointType alloc] init],
[NSNumber numberWithInt:-1]:[[PolygonPointWaypointType alloc] init],
@0:[[OtherWaypointType alloc] init],
@1: [[FixedCameraWaypointType alloc] init],
};
NSLog(@"Types: %@", [types description]);
for (NSNumber *key in [types allKeys])
{
NSLog(@"1. Key: %@", key);
}
types = @{
//https://feedbackassistant.apple.com/feedback/13181573
@-2:[[CircleWaypointType alloc] init],
@-1:[[PolygonPointWaypointType alloc] init],
@0:[[OtherWaypointType alloc] init],
@1: [[FixedCameraWaypointType alloc] init],
};
for (NSNumber *key in [types allKeys])
{
NSLog(@"2. Key : %@", key);
}
}
And output for @-1 and [NSNumber numberWithInt:-1] is the same in the unit test:
2023-09-18 17:16:48.788685+0200 speedometer[84584:1342510] 1. Key: -1
2023-09-18 17:16:48.789099+0200 speedometer[84584:1342510] 2. Key : -1
I tried then to run the app itself in the simulator (was running on a iOS 16 and 17 devices before). When ran as the app in iOS 17 simulator @-1 and @(-1) turns into 18446744073709551615 in the dictionary, same as it is doing it on iOS 16-17 devices.
Xcode is Version 15.0 (15A240d)
Looks like that unit test doesn't reveal the issue, compiling/running as the app does. Either on simulator or the real device.
Thank you for the suggestions!
Stan.
P.S. Here it is in the debugger preview while running the app in the simulator (same on the real device):
It doesn't match -1 for the objectForKey when NSNumber is -1, so it should be turning into this value 18446744073709551615, I think this is not just a debugger misrepresentation.
P.P.S. Also strange how @1 is of (int) type, but @6 is (long), why it would be like this? Looks like some unexpected type random conversion liberty by a compiler (or debugger in this case?).