आप प्रलेखन HERE पढ़ सकते हैं। यहाँ ट्यूटोरियल है कि आप आप HERE और HERE पा सकते हैं कि देखने के लिए पसंद कर सकते हैं की एक और जोड़ी हैं
//First of all import the AddRessBookUI
#import <AddressBookUI/AddressBookUI.h>
// Request to authorise the app to use addressbook
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(nil, nil);
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
if (granted) {
// If the app is authorized to access the first time then add the contact
[self _addContactToAddressBook];
} else {
// Show an alert here if user denies access telling that the contact cannot be added because you didn't allow it to access the contacts
}
});
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) {
// If the user user has earlier provided the access, then add the contact
[self _addContactToAddressBook];
}
else {
// If the user user has NOT earlier provided the access, create an alert to tell the user to go to Settings app and allow access
}
:
आपके प्रारंभ करने के लिए कुछ कोड है।
आशा है कि इससे मदद मिलती है!
अद्यतन: आप पहली बार आपके ऐप्लिकेशन को लॉन्च पता लगाने के लिए didFinishLaunchingWithOptions उपयोग करने के लिए:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
{
// The app has already launched once
}
else
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
// This is the first time the app is launched
}
}
जांचें [प्रोग्रामेटिक रूप से संपर्कों तक पहुंच का अनुरोध करें] (http://stackoverflow.com/questions/12648244/programmatically-request-access-to-contacts) –
आईओएस 9 और ऊपर: http://stackoverflow.com/a/ 3 9 374 9 16/569789 – Zaraki