안녕하세요,이 사용자 지정 주소록을 만들고 있는데 전자 메일 주소가있는 사용자 만 완벽하게 작동하지만 테이블 뷰에서 이미지를 표시하려고하면 EXCBAD Error
이 표시됩니다. 나는 그것을 완벽하게 저장 될 것입니다있는 NSMutableArray에 이미지 저장 이미지를 가져 오는하고 위의 코드에서 여기주소록에서 이미지를 가져 와서 NSmutablearray에 저장했지만 아이폰 SDK에 'EXCBAD 오류'가 표시됩니다.
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
for (CFIndex i = 0; i < CFArrayGetCount(people); i++) {
ABRecordRef person = CFArrayGetValueAtIndex(people, i);
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
for (CFIndex j=0; j < ABMultiValueGetCount(emails); j++) {
UIImage *img;
if(ABPersonHasImageData(person))
{
// img = [UIImage imageWithData:(NSData *)ABPersonCopyImageDataWithFormat(person,kABPersonImageFormatThumbnail)];
img = [UIImage imageWithData:(NSData *)ABPersonCopyImageData(person)];
// if(img != nil)
// {
// [arrImage addObject:img];
// }
// else
// {
img = [UIImage imageNamed:@"icon-9.png"];
[arrImage addObject:img];
// }
}else
{
img = [UIImage imageNamed:@"icon-9.png"];
[arrImage addObject:img];
}
NSString* email = (NSString*)ABMultiValueCopyValueAtIndex(emails, j);
// [arrImage addObject:img];
[arrEmail addObject:email];
[img release];
[email release];
}
CFRelease(emails);
}
CFRelease(addressBook);
CFRelease(people);
같은 코드가 있습니다. 내가 이미지가 여기 img = [UIImage imageNamed:@"icon.png"];
만에서 호출 될 때 아래 코드
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UIImageView* imagePhoto;
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableFriends dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
imagePhoto= [[[UIImageView alloc] initWithFrame:CGRectMake(43.0,10.0,40, 40)] autorelease];
if ([arrEmail count] != 0)
{
imagePhoto.image = [arrImage objectAtIndex:indexPath.row];
[cell.contentView addSubview:imagePhoto];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",[arrEmail objectAtIndex:indexPath.row]];
cell.detailTextLabel.textColor = [UIColor whiteColor];
}
return cell;
}
가 perfecly 작동에 이미지를 표시하기 위하여려고 할 때 이미지가 주소록에서 호출 될 때 그러나 그것은 나에게 그 코드에 무슨 잘못 EXCBAD Error
의 오류를 제공 ? NSMutabeArray에 이미지를 저장하고 이미지를 표시하려면 어떻게해야합니까?
헤이 어떤 몸이 좀 도와 또는 내가 당신이보고 난 그냥 내 모든 코드가 좋은 만 작동하고 어떤이 응용 프로그램의 기능과 같은 몇 가지를 구현하려는 아이폰 주소록에서 친구를 추가 할 수 있습니다이의 Google Latitude 처럼 구현하기 위해 제안 할 수 있습니다 도와 주소록에서 이미지를 가져올 수 없습니다. ...
아무도 도와주세요. –