如何获取字符串数据iOS Objective-C的数组



我有以下数据类型,我坚持如何获取数据。

  "(n        {n        RecordID = "<CPRecord: 0x188471b0 ABPerson>";n        birthday = "";n        emailAddress = "";n        firstName = Communication;n        imageData = "";n        jobTitle = "";n        lastName = A;n        note = "";n        organizationName = "";n        phoneIdentifier = "91E0D30B-EDB9-4735-BE46-A000F6D10A15";n        phoneNumber = "";n        userName = "Communication A";n    },n        {n        RecordID = "<CPRecord: 0x18847340 ABPerson>";n        birthday = "";n        emailAddress = "";n        firstName = Communication;n        imageData = "";n        jobTitle = "";n        lastName = A;n        note = "";n        organizationName = "";n)"

看起来像某人将数据存储到您的SQL数据库中时,他们以主要的方式搞砸了。这看起来像是描述属性将返回到字典中,这绝对是放入数据库中的垃圾。

您绝对无法可靠地对其进行整理。与负责存储数据并使他们清理混乱的人交谈。或与他们一起玩一些乐趣,并要求他们提供格式规格(并不是说将会有任何有用的内容)。

您无法对此进行解决的一个原因是,到数据库写作的天才编写了CPRECORDS的内存地址(无论CPRECORDS,无论是什么)。有人创建了此垃圾数据,让他们对其进行分类。

我没有得到您想要什么,但我认为您想要 ->

更新2

在您的.h文件中

@property (nonatomic, retain) NSArray *your_array; 

在您的.m文件中

NSString *str = [NSString StringwithFormat:@"%@",yourstring];
NSArray *arr = [str componentsSeparatedByString:@","];
your_array=[NSArray arrayWithArray:arr];

更新1

将数据存储在数组中,例如your_array

然后喜欢以下方式:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *content = [self.your_array objectAtIndex:0];
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"//your_cell_identifier" forIndexPath:indexPath];
    [cell.Title setText:[content valueForKey:@"RecordID"]];

    return cell;
}

最新更新