我正在使用此代码
NSDictionary *yourDictionary;
NSArray * yourKeys;
yourKeys = [yourDictionary allValues];
获取字典的值。但我希望以这种形式输出数组:array[0],array[1],而我在控制台中获得如下输出:-
2013-01-12 18:44:10.213 Birthday_Reminder[2871:c07] (
{
},
"Arpit Sihare")
等等值。所以请帮助我以这种形式获取这些值,并且我正在使用 KABPersonfirstnameproperty 从通讯簿中检索这些名称。
ABAddressBookRef addressBook = ABAddressBookCreate();
NSArray *thePeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
NSMutableArray* allPeoplesDicts = [NSMutableArray array];
for (id person in thePeople)
{
ABMultiValueRef phone =(NSString*)ABRecordCopyValue(person, kABPersonPhoneProperty);
NSString* name = (NSString *)ABRecordCopyCompositeName(person);
// NSMutableArray* phones = [[NSMutableArray alloc] init];
NSDictionary *phones=[[NSDictionary alloc]init ];
for (CFIndex i = 0; i < ABMultiValueGetCount(phones); i++)
{
NSString *phone = [(NSString *)ABMultiValueCopyValueAtIndex(phones,i) autorelease];
[phones addObject:phone];
}
NSDictionary* personDict = [[NSDictionary alloc] initWithObjectsAndKeys:name,@"Name",phones,@"PhoneNumbers",nil];
[phones release];
NSArray * yourKeys;
yourKeys = [personDict allValues];
NSLog(@"%@",yourKeys);
[allPeoplesDicts addObject:personDict];
[personDict release];
}
我想要数组形式的名字,当我使用 nslog(@"%@",array[0]) 它应该首先打印存储在数组中的值,很快就会像数组 [1]....