Objective-C: How to check if the key and value data types are expected data types in a NSDictionary?

If your code base still uses Objective-C as of August 2019. You might want to check if your application or library crashes if you are inserting wrong data type in a NSDictionary because the Objective-C compiler does not complain if the key and value data types are not the same as the expected data type in a NSDictionary during compile time. The crash will only occur during run time. The following are the run time scenarios for the crash occurence,