0

running into a weird issue

I have a condition that checks whether a leftBarButtonItem exists and performs an action based on that.

So my check is simple:

  if (!self.navigationItem.leftBarButtonItem)

However, I am running into a situation where the leftBarButtonItem does not exist, but it is also not nill. It is (null).

And the way I find that out is by printing it out:

  NSLog(@"left nav button %@", self.navigationItem.leftBarButtonItem);

Read:

  left nav button (null)

How can you check whether it is NULL since the nil check is not working?

I have tried checking against [NSNull null], isKindOfClass: NSNull Class, == NULL, == NSNull null, (NSNull *) self.navigationItem.leftBarButtonItem == [NSNull null]

I even tried to make a string with leftBarButton's description and check that for null. No go.

Any idea?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Live2Enjoy7
  • 1,075
  • 2
  • 11
  • 22

0 Answers0