3

we have an issue when we are using [PFObject pinAllInBackground:] in the Parse iOS SDK.

We discover that when we use [PFObject pinAllInBackground], the UI will freeze sometimes. For example, we have get a list of Post objects using PFQuery, while Post has some pointer fields that are included in the query. In the success block of query, we call pinAllInBackground to cache all the Post objects retrieved into our local store (some of these post may have been pinned before). After that (not asynchronously wait until pin is completed using BFTask or block), we immediately replace our table view's data source with posts and reload the table view. Our issue is that, the UI will always freeze for at least half to one second during this process (like sudden stop while scrolling the table view, no response while switching into a different view in the tab, etc). If I comment out the line of pinAllInBackground, the UI freeze disappears. This is always reproducible in our app.

I also notice that the PFPinningObjectStore seems to always re-pinning every objects in my local datastore (I have 491 objects pinned in my app when I tested).

As what I learned before, the pin process is supposed to executes in a different thread other than the main thread, and hence it should't affect the UI when we call pinAllInBackground. Are there any type of actions may be conflicted with pinAllInBackground, and blocking the main queue? Thanks!

P.S. We are also using Realm to persist some type of objects. Not sure if it is related in any case.

Martin Lai
  • 165
  • 2
  • 8

0 Answers0