Trouble getting NSString from NSDictionary key into UILabel
- by Brian
I'm attempting to put the value associated with the key called "duration" into a UILabel
but I'm getting a blank or "(null)" result showing up in the UILabel.
My NSDictionary object with its keys seems to be logging as being full of the data and keys I think I want, as such:
the content of thisRecordingsStats is
{
"12:48:25 AM, April 25" = {
FILEPATH = "/Users/brian/Library/Application
Support/iPhone
Simulator/3.1.3/Applications/97256A91-FC47-4353-AD01-15CD494060DD/Documents/12:48:25
AM, April 25.aif";
duration = "00:04";
applesCountString = 0;
...and so on.
Here's the code where I'm trying to put the NSString into the UILabel:
cell.durationLabel.text = [NSString stringWithFormat:@"%@",[thisRecordingsStats objectForKey:@"duration"]];
I've also tried these other permutations:
cell.durationLabel.text = [thisRecordingsStats objectForKey:@"duration"];
and I've also tried this tag-based approach:
label = (UILabel *)[cell viewWithTag:8];
label.text = [[thisRecordingsStats objectForKey:@"duration"] objectAtIndex:1];
and:
UILabel *label;
label = (UILabel *)[cell viewWithTag:8];
label.text = [NSString stringWithFormat:@"%@",[[thisRecordingsStats objectForKey:@"duration"] objectAtIndex:1]];
I've also tried creating a string from the key's paired value and see a "(null)" value or blankness using that too.
What am I missing? I assume it's something with the formatting of the string. Thanks for looking!!