id type to NSString

Viewed 44155

is there any way by which I can change an id type to NSString object? note the following line of my code.

NSString *value = [appDelegate.bird_arr objectAtIndex:rowClicked] ;

in this appDelegate is object of my AppDelegate class in a navigation based program and bird_arr is object of NSMutableArray. I want to use the string written in row which is clicked. But objectAtIndex: returns id type. Do we have any way to change this id type to NSString or any other way by which I can collect string inside the specific row?

5 Answers

in Foundation all objects inherits NSObject class which has methods like:

+ (NSString *)description;

so you can make it like this:

NSString *value = [[appDelegate.bird_arr objectAtIndex:rowClicked] description];
Related