Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allows the app to run on ios 10. Displays the actual number of contac… #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DummyContacts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down
2 changes: 2 additions & 0 deletions DummyContacts/DummyContacts-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSContactsUsageDescription</key>
<string>This app requires access to your contacts to function properly.</string>
</dict>
</plist>
6 changes: 4 additions & 2 deletions DummyContacts/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ -(void)addContacts
accessGranted = YES;
}

long countAdded = 0;
if(accessGranted)
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"DummyVCard" ofType:@"vcf"];
Expand All @@ -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];

Expand Down