Note that there are some explanatory texts on larger screens.

plurals
  1. POUICollectionView stuck in reloadData
    primarykey
    data
    text
    <p>I'm having problems with <code>[UICollectionView reloadData]</code>, which seems to get stuck for quite a while before it calls <code>numberOfSectionsInCollectionView</code> on its delegate that I have specified. This is what happens:</p> <p>The app starts with the UICollectionView immediately visible and <code>numberOfSectionsInCollectionView</code> is called on the delegate, which returns the number of items in an empty array (i.e. 0) and immediately starts to download the data for the array from a web service. Once the download is complete, the data is deserialized and added to the above array, then <code>reloadData</code> is called on the <code>UICollectionView</code> instance. This is where the app seems to stop doing anything, and after 20-30 seconds (or sometimes up to a minute), the delegate receives a call to <code>numberOfSectionsInCollectionView</code>. As soon as this call is received, the reload quickly completes.</p> <p>I believe <code>reloadData</code> runs in its own thread, but I've tried starting it in a separate thread to ensure that it's not any of my code blocking the process. What could <code>reloadData</code> be doing while it appears stuck? Are there any intermediary delegate methods between <code>reloadData</code> and <code>numberOfSectionsInCollectionView</code> that I should be implementing? I thought that is the first method to be called following a reload as far as an iOS developer is concerned.</p> <p>If anyone could tell me what may be going wrong, fantastic, but I'd also appreciate any tips on how to debug this!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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