Error occurs when I convert NSMutableArray to NSArray

Posted by Ali on Stack Overflow See other posts from Stack Overflow or by Ali
Published on 2011-01-05T12:48:55Z Indexed on 2011/01/05 12:54 UTC
Read the original article Hit count: 233

Filed under:

Hi All, I want to convert NSMutableArray to NSArray to it gives error following is code

ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);

tempPeoples=[[NSMutableArray alloc]init];

for(int i=0;i<nPeople;i++){

    ABRecordRef i1=CFArrayGetValueAtIndex(allPeople, i);
    [tempPeoples addObject:i1];

//  [peoples addObject:i1];

}// end of the for loop

// Peoples is NSArray

// peoples=[[NSArray alloc] initWithArray: tempPeoples];

peoples=[NSArray arrayWithArray:tempPeoples];

Please help

© Stack Overflow or respective owner

Related posts about nsmutablearray