6

When using ABPeoplePickerNavigationController it takes a moment (~0.5 sec) to load and display the control which is slower than the normal reaction time of other popups.

I came with the solution set the controller as a variable and access this pre-loaded object via:

[self presentViewController:self.peoplePicker animated:YES completion:nil];

Just out of curiosity, is there another way to fire up the picker without preloading it?

Carsten
  • 1,029
  • 14
  • 29
  • 1
    I am getting the same problem. Did you pre-load the ABPeoplePickerNavigationController in your ViewController's ViewDidLoad or something? I've whacked it inside ViewDidAppear and it's still somewhat slow. – micnguyen Jun 02 '15 at 01:30
  • 1
    use instruments to find out which part is time-costy – Wingzero Jun 02 '15 at 01:36
  • 1
    I'm initializing a picker and store that on `-viewDidLoad:`, yes. This works but feels weird in the world of lazy loading. If that's the only way to handle it, I'm ok. – Carsten Jun 02 '15 at 09:25

1 Answers1

4

Same here, I don't have the answer to solve it and I think that it could be an iOS 8 bug (UPDATE: yes it its, Apple confirmed it).

In my tests on iOS 7.x the ABPeoplePicker presentation time is less than 0.2 sec.

The problem appears only on iOS 8.x, and only the first time that you present the ABPeoplePicker. The ABPeoplePicker presentation takes about 3 sec in my application and about 1,5 sec in a sample application that do only the ABPeoplePicker presentation by pressing a button. I tested it both on simulator and device with ~20 contacts.

Pre-loading the instance doesn't change significantly the presentation time just as I expected. I've also tried to force the presentation on the main thread and to set animation to NO, but it's still slow on iOS 8.

The time profiler doesn't help me because I can't see an unexpected long time of computation.

While we wait for the supposed bug fix, I think that the best workarounds are to show an activity progress indicator while loading the ABPeoplePicker or to implement our own ABPeoplePicker.

I've implemented my own, you can find it on GitHub: VeeContactPicker, and of course use it!

NEWS FROM APPLE:

Apple team answered to my bug report:

Apple Developer Relations 16-Jun-2015 00:36 AM

We believe this issue has been addressed in the latest iOS 9 beta. This is a pre-release iOS 9 update. Please refer to the release notes for complete installation instructions. Please test with this release. If you still have issues, please provide any relevant logs or information that could help us investigate.*

iOS 9 update

In iOS 9 the ABFramework has been deprecated for a new object-oriented contacts framework that comes with a new picker [see CNContactPicker]! Unfortunately it seems that the issue hasn't been resolved, the logic has been updated but the ViewController is still the same one as of iOS 8. So the CNContactPicker is still very slow to load and display the control...

I've reported the bug to Apple, waiting for news...

andreacipriani
  • 2,519
  • 26
  • 23
  • It's maybe related to the tweaked permission system for contacts? How many contacts do you have? On my side it's ~350 and the times you measured seem to be comparable to my guesstimates. – Carsten Jun 09 '15 at 10:05
  • My tests were done with ~20 contacts, i'm adding it to the response – andreacipriani Jun 09 '15 at 10:06
  • Any idea, if they are actually aware of that issue and are working to fix that since they will deprecate AddressBook in iOS9 and repalce it with Contacts framework anyway ? It's really annoying though. – Artrmz Jun 11 '15 at 07:47