mirror of
https://github.com/zhigang1992/iOS-6-Advanced-Cookbook.git
synced 2026-01-12 22:48:06 +08:00
Added label guard for nil values courtesy of Chris Ozenne
This commit is contained in:
BIN
C09 - Address Book/00 - AB Basic/.DS_Store
vendored
BIN
C09 - Address Book/00 - AB Basic/.DS_Store
vendored
Binary file not shown.
@@ -433,7 +433,10 @@
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
|
||||
Binary file not shown.
BIN
C09 - Address Book/01 - Search/.DS_Store
vendored
BIN
C09 - Address Book/01 - Search/.DS_Store
vendored
Binary file not shown.
@@ -428,17 +428,21 @@
|
||||
{
|
||||
CFTypeRef theProperty = ABRecordCopyValue(_record, anID);
|
||||
if (!theProperty) return nil;
|
||||
|
||||
|
||||
NSMutableArray *labels = [NSMutableArray array];
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
}
|
||||
|
||||
|
||||
- (NSArray *) emailArray {return [self arrayForProperty:kABPersonEmailProperty];}
|
||||
- (NSArray *) emailLabels {return [self labelsForProperty:kABPersonEmailProperty];}
|
||||
|
||||
|
||||
BIN
C09 - Address Book/02 - Image/.DS_Store
vendored
BIN
C09 - Address Book/02 - Image/.DS_Store
vendored
Binary file not shown.
@@ -428,12 +428,15 @@
|
||||
{
|
||||
CFTypeRef theProperty = ABRecordCopyValue(_record, anID);
|
||||
if (!theProperty) return nil;
|
||||
|
||||
|
||||
NSMutableArray *labels = [NSMutableArray array];
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
|
||||
BIN
C09 - Address Book/03 - Browsing/.DS_Store
vendored
BIN
C09 - Address Book/03 - Browsing/.DS_Store
vendored
Binary file not shown.
@@ -428,12 +428,15 @@
|
||||
{
|
||||
CFTypeRef theProperty = ABRecordCopyValue(_record, anID);
|
||||
if (!theProperty) return nil;
|
||||
|
||||
|
||||
NSMutableArray *labels = [NSMutableArray array];
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
|
||||
BIN
C09 - Address Book/04 - Type Picker/.DS_Store
vendored
BIN
C09 - Address Book/04 - Type Picker/.DS_Store
vendored
Binary file not shown.
@@ -428,12 +428,15 @@
|
||||
{
|
||||
CFTypeRef theProperty = ABRecordCopyValue(_record, anID);
|
||||
if (!theProperty) return nil;
|
||||
|
||||
|
||||
NSMutableArray *labels = [NSMutableArray array];
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
|
||||
BIN
C09 - Address Book/05 - New Contact/.DS_Store
vendored
BIN
C09 - Address Book/05 - New Contact/.DS_Store
vendored
Binary file not shown.
@@ -428,12 +428,15 @@
|
||||
{
|
||||
CFTypeRef theProperty = ABRecordCopyValue(_record, anID);
|
||||
if (!theProperty) return nil;
|
||||
|
||||
|
||||
NSMutableArray *labels = [NSMutableArray array];
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
|
||||
BIN
C09 - Address Book/06 - Monsters/.DS_Store
vendored
BIN
C09 - Address Book/06 - Monsters/.DS_Store
vendored
Binary file not shown.
@@ -428,12 +428,15 @@
|
||||
{
|
||||
CFTypeRef theProperty = ABRecordCopyValue(_record, anID);
|
||||
if (!theProperty) return nil;
|
||||
|
||||
|
||||
NSMutableArray *labels = [NSMutableArray array];
|
||||
for (int i = 0; i < ABMultiValueGetCount(theProperty); i++)
|
||||
{
|
||||
NSString *label = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(theProperty, i);
|
||||
[labels addObject:label];
|
||||
if (label)
|
||||
[labels addObject:label];
|
||||
else
|
||||
[labels addObject:@""];
|
||||
}
|
||||
CFRelease(theProperty);
|
||||
return labels;
|
||||
|
||||
Reference in New Issue
Block a user