From d6817c118666f565c8a194e70a7dcbbebf54c655 Mon Sep 17 00:00:00 2001 From: Andy Martin Date: Wed, 20 Sep 2017 18:54:31 -0500 Subject: [PATCH 1/2] allows the app to run on ios 10. Displays the actual number of contacts added --- DummyContacts.xcodeproj/project.pbxproj | 4 ++-- DummyContacts/DummyContacts-Info.plist | 2 ++ DummyContacts/ViewController.m | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DummyContacts.xcodeproj/project.pbxproj b/DummyContacts.xcodeproj/project.pbxproj index b55c92d..24012a7 100644 --- a/DummyContacts.xcodeproj/project.pbxproj +++ b/DummyContacts.xcodeproj/project.pbxproj @@ -314,7 +314,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "DummyContacts/DummyContacts-Prefix.pch"; INFOPLIST_FILE = "DummyContacts/DummyContacts-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -326,7 +326,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "DummyContacts/DummyContacts-Prefix.pch"; INFOPLIST_FILE = "DummyContacts/DummyContacts-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/DummyContacts/DummyContacts-Info.plist b/DummyContacts/DummyContacts-Info.plist index 4c8cb95..3264a54 100644 --- a/DummyContacts/DummyContacts-Info.plist +++ b/DummyContacts/DummyContacts-Info.plist @@ -34,5 +34,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + NSContactsUsageDescription + This app requires access to your contacts to function properly. diff --git a/DummyContacts/ViewController.m b/DummyContacts/ViewController.m index d19c2c4..d2a15b6 100644 --- a/DummyContacts/ViewController.m +++ b/DummyContacts/ViewController.m @@ -71,6 +71,7 @@ -(void)addContacts accessGranted = YES; } + long countAdded = 0; if(accessGranted) { NSString *filePath = [[NSBundle mainBundle] pathForResource:@"DummyVCard" ofType:@"vcf"]; @@ -90,12 +91,13 @@ -(void)addContacts CFRelease(person); } + countAdded += CFArrayGetCount(vCardPeople); CFRelease(vCardPeople); CFRelease(defaultSource); } - - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"100 contacts added successfully." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; + NSString *msg = [NSString stringWithFormat:@"%ld contacts added successfully.", countAdded]; + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [alertView show]; [alertView release]; From 8bc689d673f284f18dd6bfa3b223f3f7d4f23b01 Mon Sep 17 00:00:00 2001 From: Andy Martin Date: Wed, 20 Sep 2017 18:56:13 -0500 Subject: [PATCH 2/2] fix spacing --- DummyContacts/ViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DummyContacts/ViewController.m b/DummyContacts/ViewController.m index d2a15b6..486782f 100644 --- a/DummyContacts/ViewController.m +++ b/DummyContacts/ViewController.m @@ -91,7 +91,7 @@ -(void)addContacts CFRelease(person); } - countAdded += CFArrayGetCount(vCardPeople); + countAdded += CFArrayGetCount(vCardPeople); CFRelease(vCardPeople); CFRelease(defaultSource); }