isKindOfClass returns null instead of YES or NO
isKindOfClass returns null instead of YES or NO
- Subject: isKindOfClass returns null instead of YES or NO
- From: Jeff Decker <email@hidden>
- Date: Wed, 20 May 2009 11:43:13 -0400
Hello,
I am working through the Stanford iPhone Dev assignments along with
the videos on iTunes. And I'm stuck on the assignment for the first
week. Shoot!
My goal is inspect each object of an array. When I use isKindOfClass
or isMemberOrClass, I do not get an expected YES or NO but rather a
(null).
Here is the relevant code:
NSMutableArray *myArray = [NSMutableArray arrayWithObjects:[NSURL
URLWithString:@"AccountableTreeService.com"], @"Hello World",
[NSProcessInfo processInfo], dictionary, mutableString, nil];
NSEnumerator *enumerator = [myArray objectEnumerator];
id step;
while (step = [enumerator nextObject]){
NSLog(@"========================================");
NSLog(@"Class name: %@", [step className]);
NSLog(@"Is Member of NSURL: %@", [[step class] isMemberOfClass:
[NSURL class]]);
NSLog(@"Is Kind of NSString: %@", [[step class] isKindOfClass:
[NSString class]]);
NSLog(@"Responds to LowercaseString: ");//I'm still working on this
part
}
And here are my unexpected results:
2009-05-20 11:23:31.666 StanfordAssignment1B[18975:10b]
========================================
2009-05-20 11:23:31.667 StanfordAssignment1B[18975:10b] Class name:
NSURL
2009-05-20 11:23:31.668 StanfordAssignment1B[18975:10b] Is Member of
NSURL: (null)
2009-05-20 11:23:31.668 StanfordAssignment1B[18975:10b] Is Kind of
NSString: (null)
2009-05-20 11:23:31.669 StanfordAssignment1B[18975:10b] Responds to
LowercaseString:
2009-05-20 11:23:31.670 StanfordAssignment1B[18975:10b]
========================================
2009-05-20 11:23:31.671 StanfordAssignment1B[18975:10b] Class name:
NSCFString
2009-05-20 11:23:31.673 StanfordAssignment1B[18975:10b] Is Member of
NSURL: (null)
2009-05-20 11:23:31.673 StanfordAssignment1B[18975:10b] Is Kind of
NSString: (null)
2009-05-20 11:23:31.674 StanfordAssignment1B[18975:10b] Responds to
LowercaseString:
2009-05-20 11:23:31.674 StanfordAssignment1B[18975:10b]
========================================
2009-05-20 11:23:31.674 StanfordAssignment1B[18975:10b] Class name:
NSProcessInfo
2009-05-20 11:23:31.675 StanfordAssignment1B[18975:10b] Is Member of
NSURL: (null)
2009-05-20 11:23:31.675 StanfordAssignment1B[18975:10b] Is Kind of
NSString: (null)
2009-05-20 11:23:31.675 StanfordAssignment1B[18975:10b] Responds to
LowercaseString:
2009-05-20 11:23:31.676 StanfordAssignment1B[18975:10b]
========================================
2009-05-20 11:23:31.677 StanfordAssignment1B[18975:10b] Class name:
NSCFDictionary
2009-05-20 11:23:31.680 StanfordAssignment1B[18975:10b] Is Member of
NSURL: (null)
2009-05-20 11:23:31.681 StanfordAssignment1B[18975:10b] Is Kind of
NSString: (null)
2009-05-20 11:23:31.682 StanfordAssignment1B[18975:10b] Responds to
LowercaseString:
2009-05-20 11:23:31.683 StanfordAssignment1B[18975:10b]
========================================
2009-05-20 11:23:31.683 StanfordAssignment1B[18975:10b] Class name:
NSCFString
2009-05-20 11:23:31.683 StanfordAssignment1B[18975:10b] Is Member of
NSURL: (null)
2009-05-20 11:23:31.684 StanfordAssignment1B[18975:10b] Is Kind of
NSString: (null)
2009-05-20 11:23:31.684 StanfordAssignment1B[18975:10b] Responds to
LowercaseString:
Thanks for any help!
Jeff
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden