开发者

What is wrong with this NULL check for a ViewController?

myCustomController *controller = [myMutableArray objectAtIndex:page];

NSLog(@"%@",controller); // <- THIS RETURNS NULL IN CONSOLE

if 开发者_高级运维((NSNull *)controller == [NSNull null]) {
 // Why is the above check not working if controller in console says it's null?
 // It's not jumping into this loop. Has something changed in iOS4.0 SDK?
}

what is wrong with this null check for a viewController, it does not seem to be working.


NSLog should return (null) (which probably is description for nil), not NULL in console. Your check should look like this:

if (!controller) {
  // do some stuff here
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜