Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Peter Tomaselli
Yup, that’s my problem exactly. You explained it much better than I could! To be honest, I don’t have a real good reason for not using the main thread at the moment—it seems fine, performance-wise, for what I am doing. But I was interested in hearing if there was a more performant approach I

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Quincey Morris
On Apr 25, 2015, at 17:54 , Peter Tomaselli peter.tomase...@icloud.com wrote: I don’t have a real good reason for not using the main thread at the moment—it seems fine, performance-wise, for what I am doing. The point of these restrictions on ABAddressBook is that it’s *already* an

Work with AddressBook without blocking the main thread

2015-04-25 Thread Peter Tomaselli
Hi there. I’m writing my first iPhone application and trying to figure out how to best work—asynchronously—with the AddressBook API. I’m building against iOS 8. I’m not experienced with Cocoa, but based on the docs, as well as seemingly-credible SO answers (particularly this one[0]), my

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Peter Tomaselli
Thanks for the reply. Well, now you’ve got me doubting myself. This is for iOS. Isn’t the C API the only option on that platform? I am planning on doing some work with the address book that doesn’t seem to be directly supported in the API (basically, I want to display all the email addresses

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Quincey Morris
On Apr 25, 2015, at 17:06 , Peter Tomaselli peter.tomase...@icloud.com wrote: The crux of my problem is that, according to the docs, ABAddressBookRequestAccessWithCompletion’s completion handler “is called on an arbitrary queue”. However, ABAddressBookRequestAccessWithCompletion accepts as

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Roland King
Also, the post served to bring dispatch_get_current_queue() to my attention, which seems quite handy. Don’t get too excited on that score, it was deprecated 2 OS revisions ago despite there being some legitimate use cases for it. My bug report on that got closed with the “not changing

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Quincey Morris
On Apr 25, 2015, at 18:51 , Peter Tomaselli peter.tomase...@icloud.com wrote: This is for iOS. Isn’t the C API the only option on that platform? Yes, by the time I got there I didn’t notice that it was OS X only. I realize I was wrong, too, to call the address book API asynchronous. When you

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Peter Tomaselli
Ha, great link! It was fun reading about the possible pitfalls here. Database corruption simply by reading improperly? Yikes! Also, the post served to bring dispatch_get_current_queue() to my attention, which seems quite handy. This fella does not mention how he handles the whole “the

Re: Work with AddressBook without blocking the main thread

2015-04-25 Thread Roland King
I had trouble believing there was an API left which was really thread-tied - until I convinced myself that this one really is. I wonder why, underlying SQL implementation perhaps? In the course of hunting around I found a blog entry here