iOS simulator crashing with error: NSInvalidArgumentException (solution)

Hi all,

I saw a few people posting a similar bug to something I have been experiencing.

Typically the iOS simulator will crash with the following error:

Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance

I thought the simulator was crashing because I was making a call to navigator.contacts.find almost as soon as the deviceready is fired.

Turns out it was because I was searching by contact id, and the id value was -1 as an integer.
When I converted this to a string, the problem was fixed!

Hopefully this will help others track down and fix similar bugs they may be experiencing