Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More address book permission checking

  • Loading branch information...
commit 8bd8e5030d6d4cfae1e72deac4458cf6f74e1b7d 1 parent 2a22ca4
@gonfunko authored
View
BIN  GauchoMobile.xcodeproj/project.xcworkspace/xcuserdata/Bob.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
16 src/Parsers/GMParticipantsParser.m
@@ -66,15 +66,19 @@ - (NSArray *)participantsFromSource:(NSString *)source {
currentRow = [currentRow substringFromIndex:cruftRange.location + cruftRange.length];
int lastAccessEnd = [currentRow rangeOfString:@"<"].location;
NSString *lastAccessed = [currentRow substringWithRange:NSMakeRange(0, lastAccessEnd)];*/
-
+
BOOL inAddressBook = NO;
ABAddressBookRef addressBook = ABAddressBookCreate();
- CFArrayRef matches = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
- if (CFArrayGetCount(matches) != 0)
- inAddressBook = YES;
+ ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {});
- CFRelease(addressBook);
- CFRelease(matches);
+ if (addressBook) {
+ CFArrayRef matches = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
+ if (CFArrayGetCount(matches) != 0)
+ inAddressBook = YES;
+
+ CFRelease(addressBook);
+ CFRelease(matches);
+ }
//Create a participant object to model this participant
GMParticipant *participant = [[GMParticipant alloc] init];
Please sign in to comment.
Something went wrong with that request. Please try again.