On iOS6, apple introduce new privacy control, user can control the accessment of contact and calender by each app.
So, in the code side, you need to add some way to request the permission.
In iOS5 or before, we can always call
ABAddressBookRef addressBook = ABAddressBookCreate();
to get the addressbook without any problem,
but in iOS6, if you don't have permission, this call will just return empty pointer.
That why we need to change the method to get ABAddressBookRef.
__block BOOL accessGranted = NO;
if (ABAddressBookRequestAccessWithCompletion != NULL) { // we're on iOS 6
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
accessGranted = granted;
dispatch_semaphore_signal(sema);
});
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
dispatch_release(sema);
}
else { // we're on iOS 5 or older
accessGranted = YES;
}
if (accessGranted) {
// Do whatever you want here.
}
In the code,semaphore is used for blocking until response, while ABAddressBookRequestAccessWithCompletion will ask for permission if the app didn't ask before. Otherwise it will just follow the settings in Settings-Privacy-Contact.
Thanks .It helped me a lot.
回覆刪除Nice & Informative Blog !
回覆刪除If you are looking for the best accounting software that can help you manage your business operations. call us at QuickBooks Customer Service Number 1-855-974-6537.
Hey! Amazing work. With full of knowledge. Our Team resolve any glitches occurring while utilizing the software. Looking Quickbooks For Mac Support Phone Number 1-855-756-1077. Our experts will assist you to fulfil your accounting needs. The solutions are accurate and time-saving.
回覆刪除Nice Blog !
回覆刪除At times, while filing form 941, you may face QuickBooks Form 941 Error when the total sum of the tax amount exceeds $2500. To fix such issue, you must contact our experts via QuickBooks Support Number and get permanent ways to solve QuickBooks problems.
Garlic Bulb Cutting Machine
回覆刪除Garlic Peeling Machine
Garlic Peeling Machine
Removing Machine
Silage Machine
Peanut Peeling Machine
Architectural consultants in Dubai
回覆刪除Architectural firms in Dubai
Quality is our priority. And we do everything to achieve that such as choosing suitable essay assignment writer for the job, conveying customers’ suggestions to the writer, setting up a quality management team, etc. This way, we ensure that all our customers receive highest quality essay assignment assistance from us.
回覆刪除http://www.dissertationhomework.com
Good luck & keep writing such awesome content.
回覆刪除Best dental clinic in Faridabad
best child dentist in greater Noida
coaching in Greater Noida for CBSE 9 10 11 12th
Feeling wonderful after reading as such post. Thank you for sharing. Keep going
Virgin Linseed Oil BP
Pure Linseed Oil
Best content & valuable as well. Thanks for sharing this content.
回覆刪除Approved Auditor in DAFZA
Approved Auditor in RAKEZ
Approved Auditor in JAFZA
i heard about this blog & get actually whatever i was finding. Nice post love to read this blog
Approved Auditor in DMCC
Always look forward for such nice post & finally I got you. Really very impressive post & glad to read this.
回覆刪除Web Development Company in Greater Noida
Software development company In Greater noida
Homoeopathic treatment for Psoriasis in greater noida
Kidney Disease Homoeopathy Doctor In Greater Noida
CMS and ED
CMSED
thank you for providing us this useful information do Busines with Intwiff
回覆刪除Hey! Mind-blowing blog. Keep writing such beautiful blogs. In case you are struggling with issues on QuickBooks software, dial QuickBooks Customer Service Phone Number . The team, on the other end, will assist you with the best technical services.
回覆刪除wordpress design agency in united states Need professional WordPress Web Design Services? We're experts in developing attractive mobile-friendly WordPress websites for businesses. Contact us today!
回覆刪除