Objective-C: loadItemForTypeIdentifier UI updating delay

Posted: May 21, 2015 in iOS, Objective C

I was writing a Share Extension which allows users to share a file to others. The extension will use loadItemForTypeIdentifier to fetch the file’s name and display it to the user. But users must always wait for a while before the UI is updated.

Thanks to this post, I found that it is because that UI wasn’t updated in the main queue. To fix it is very simple, just dispatch the ui updating to the main queue.

dispatch_async(dispatch_get_main_queue(), ^{
//Your UI updating logic
});
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s