Winton DeShong
Web / Flash Development

Archive for August, 2008

iPhone Dev: ABAddressBook ABMultiValue Debugging

August 24th, 2008 | Category: Frameworks, Mobile, Objective-C, iPhone

For those of you who have done work with the ABAddressBook framework, I have found the following method for testing the contents of an ABMultiValue object extremely handy!

  1. void printMultiValue(char *title,id prop, ABPerson *p){

  2. int j,k;

  3. ABMultiValue *multi = [p valueForProperty:prop];

  4. if([multi count])

  5. printf(”         * %s:\n,title);

  6. // sometimes we get NSDictionaries for values.  These

  7. // need to be handled differently (kABAddressProperty does this, for example)

  8. if ([[multi valueAtIndex:0] isKindOfClass:[NSDictionary class]] == YES){

  9. for (k=0;k<[multi count];++k){

  10. NSArray *keys, *values;

  11. keys = [[multi valueAtIndex:k] allKeys];

  12. values = [[multi valueAtIndex:k] allValues];

  13. // get the dictionary name

  14. printf(”            * %s\n,

  15. [[multi labelAtIndex:k] UTF8String]);

  16. for (j=0;j<[keys count];++j){

  17. printf(”               * %s: %s\n,

  18. [[keys objectAtIndex:j] UTF8String],

  19. [[values objectAtIndex:j] UTF8String]);

  20. }

  21. }

  22. }else{

  23. for (j=0;j<[multi count];++j){

  24. printf(”            * %s: %s\n,

  25. //[[multi identifierAtIndex:j] UTF8String],

  26. [[multi labelAtIndex:j] UTF8String],

  27. [[multi valueAtIndex:j] UTF8String]);

  28. }

  29. }

  30. }

No comments

Upcoming Events: 360|Flex

August 06th, 2008 | Category: Adobe Flex, Events

It’s official, I am attending 360|Flex in San Jose on August 18-20 with the team at andCulture. Hit me up at contact@wintondeshong.com if you are going to be at 360|Flex or in the area.

No comments

google

google

asus