Note that NSNull is actually a (singleton) object. The idea is to use it when you want to have a null value object (ie. where you can't just use a nil value or pointer). For example, as an object in an NSDictionary. It is not what you're looking for here.
If your centerOfMap is created as a CLLocationCoordinate2D this is just a simple structure, not an object. Note you would create it like this:
CLLocationCoordinate2D centerOfMap;
Not like this:
CLLocationCoordinate2D *centerOfMap;
The CLLocationCoordinate2D structure is defined as this:
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;
So, if you want to know if a given value in this is good, you need to do one of the following:
1) Have a separate member variable that says whether a valid location has been added. For example, BOOL retrievedCenterOfMap. Then set this to YES when you configure centerOfMap, so then your test becomes:
if ([myManager retrievedCenterOfMap]) {
self.centerOfMap = myManager.centerOfMap;
}
2) Set known invalid values in your centerOfMap variable. CLLocationCoordinate2DIsValid() will tell you if the centerOfMap value is valid in terms of whether it is a valid coordinate or not, but you should differentiate that from whether you have actually set it or not! The question then becomes what invalid value should you use, and will anyone checking your code in the future know what you did here.
== nil? Or simplyif (!myManager.centerOfMap)?