I am not sure what's wrong with my code. Here are the 3 functions I have that might be problematic. It's a Google Maps app for iOS.
Error message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI floatValue]: unrecognized selector sent to instance 0x60000042e680'
- (void)drawPolygon{
GMSMutablePath *rect = [GMSMutablePath path];
for (int i = 0; i <= [tappedCoordinates count]-1; i++) {
event.latitude = [[tappedCoordinates objectAtIndex:i] floatValue];
event.longitude = [[tappedCoordinates objectAtIndex:i] floatValue];
[rect addCoordinate:event];
}
// first tapped point to connect with last point in order to close the polygon.
event.latitude = [[tappedCoordinates objectAtIndex:0] floatValue];
event.longitude = [[tappedCoordinates objectAtIndex:0] floatValue];
[rect addCoordinate:event];
...
}
- (void)addMarker{
for (int i = 0; i <= [tappedCoordinates count]-1; i++) {
position.latitude = [[[tappedCoordinates objectAtIndex:i] objectAtIndex:0] floatValue];
position.longitude = [[[tappedCoordinates objectAtIndex:i] objectAtIndex:1] floatValue];
...
}
floatValueon is anNSArrayand not a string or number or whatever you're assuming it is. - dan