isKindOfClass doesn't work as expected

前端 未结 3 1284
逝去的感伤
逝去的感伤 2021-02-06 02:11

i\'m working on a iOS5+ project (xcode 4.4.1 SDK 5.1)

i have this code inside a unit test:

[_appDelegate application:nil didFinishLaunchingWithOptions:ni         


        
3条回答
  •  长情又很酷
    2021-02-06 02:51

    Converting a class name to string with NSStringFromClass will avoid problems with isKindOfClass... example:

    if ([NSStringFromClass([AViewController class]) isEqualToString:NSStringFromClass([BViewController class])])
    

提交回复
热议问题