Hi i am doing an apps where i want to collect names and phonenumber from the list and add it into array.So how do i do this.I could retrive Firstname and lastname but i am not gettig how to add Phonenumber in the below code as it is in the different For Loop it might look simple but i am stuck as i am new.
for (i = 0; i < [list count]; i++)
{
NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty);
NSString *lastName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonLastNameProperty);
NSMutableArray *name = [NSMutableArray array];
if(firstName != nil)
[name addObject:firstName];
if(lastName != nil)
[name addObject:lastName];*/
[self displaynames:name];
ABMultiValueRef mobile=ABRecordCopyValue(contactPerson, kABPersonPhoneProperty);
for (int k=0;k<ABMultiValueGetCount(mobile); k++)
{
NSString *mobileNo = (__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(mobile, k);
NSLog(@"mobile number: %@",mobileNo);
}
}
-(void)displaynames:(NSMutableArray*)names{
for(NSMutableArray* name in names){
NSLog(@"MyResult:%@ %@",[names objectAtIndex:0],[names objectAtIndex:1]);
}
So in the above code i am abe to get firstname and lastname from the list and add into array,similarly how do i get mobileno and add into same array and get the result in displaynames function as it is other for loop can anyone please edit the code and tel what changes i have to make in the above code.Also in Result everything is being Displayed Twice why so?