gpt4 book ai didi

iphone - [NSCFString objectAtIndex :]: unrecognized selector sent to instance when using nsmutabledictionery

转载 作者:行者123 更新时间:2023-11-28 18:26:18 26 4
gpt4 key购买 nike

NSDateFormatter *formatter;
NSString *dateString;
formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd-MM-yyyy HH:mm a"];
dateString = [formatter stringFromDate:[NSDate date]];
[formatter release];

appDelegate.myCallLogDict = [[NSMutableDictionary alloc]init];
[appDelegate.myCallLogDict setObject:phoneNo forKey:@"CallLogPhoneNoKey"];
[appDelegate.myCallLogDict setObject:dateString forKey:@"CallLogTimeStampKey"];

我已经将电话号码和时间存储到一个 nsmutabledictionery 中,我想像下面那样访问该词典值到 -

(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method

cell.detailTextLabel.text = [[appDelegate.myCallLogDict objectForKey:@"CallLogTimeStampKey" ]objectAtIndex:row];
cell.textLabel.text = [[appDelegate.myCallLogDict objectForKey:@"CallLogPhoneNoKey"] objectAtIndex:row];

当我运行上面的代码时,出现以下错误

请扶我起来

-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5b227e0
2011-12-15 10:06:09.050 MyDialer[1090:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5b227e0'

非常感谢您的帮助

最佳答案

试试这个:

cell.detailTextLabel.text = [appDelegate.myCallLogDict objectForKey:@"CallLogTimeStampKey"];
cell.textLabel.text = [appDelegate.myCallLogDict objectForKey:@"CallLogPhoneNoKey"];

您不需要使用 objectAtIndex,因为您通过

获取单个字符串
[appDelegate.myCallLogDict objectForKey:@"CallLogPhoneNoKey"];

关于iphone - [NSCFString objectAtIndex :]: unrecognized selector sent to instance when using nsmutabledictionery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8515248/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com