Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Firstly, try some general approaches to reduce time by using <strong>more optimized code</strong> and <strong>less repetition of code</strong> and <strong>also through less use of loops</strong> or may be <strong>only iterate loops only till the data is obtained</strong>. Also you can check whether your code is properly distributed as far as the <strong>Time Profiling</strong> is concerned. </p> <p>Secondly, we feel that time required is more because user is shown an Activity Indicator till 14 seconds. If you don't show it and don't block the User Interface till data is getting copied into your array, then user may feel that it is more smooth So here is how you can do that:</p> <p>You can use <code>NSThread</code> to allow the application to launch while you retrieve all your data from the AddressBook and Store it in your array. </p> <p>You can use </p> <pre><code>[NSThread detachNewThreadSelector:@selector(fetchAddressContacts:) withObject:nil]; </code></pre> <p>For more information you can refer to <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsthread_Class/Reference/Reference.html#//apple_ref/doc/uid/20000311-CHDEBGEC" rel="nofollow">detachNewThreadSelector: from NSThread</a></p> <p>So basically in <code>AppDelegate</code> you need to code as following in <code>AppDelegate.m</code></p> <pre><code>-(void)applicationDidFinishLaunching:(UIApplication *)application { [NSThread detachNewThreadSelector:@selector(fetchAddressContacts) withObject:nil]; } -(void)fetchAddressContacts { //Do your stuff to copy your contacts from address book to array // Once you finish this task you can trigger an NSNotification which could be caught on some other viewController or implement a delegate to transfer data to a viewController and proper actions can be executed once the data is loaded. } </code></pre> <p>Let me know if you need more help.</p> <p>Hope this helps you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload