Solved

Why Is This Taking So Long To Load

Posted on 2014-07-29
2
108 Views
Last Modified: 2016-01-21
Hi, i am building my first app which is a simple instant messaging app that allows users to send an instant update to their partner, or request an update from their partner (one to one)

The Messages area has 3 types of messages listed in chrono order (distinguished using 3 different colors):

- received (messages that you receive from your partner)
- sent (messages that you sent to your partner)
- request (update requests that your partner has sent to you)

When a user clicks into the messages screen, the query below is executed to call all of your messages. I only have a 6 test users now with about 150 messages in the database and sometimes it takes 7-8 seconds for this screen to load all of the messages.

Can anyone suggest how i could improve this area / query:

// received
 PFQuery *receive = [PFQuery queryWithClassName:PARSE_TABLE_CALL];
 [receive whereKey:PARSE_CALL_STATUS equalTo:@"Sent"];
 [receive whereKey:PARSE_CALL_TO equalTo:usersPhone];
 
 // sent
 PFQuery *sent = [PFQuery queryWithClassName:PARSE_TABLE_CALL];
 [sent whereKey:PARSE_CALL_STATUS equalTo:@"Sent"];
 [sent whereKey:PARSE_CALL_FROM equalTo:usersPhone];
 
 // requests
 PFQuery *receiveReq = [PFQuery queryWithClassName:PARSE_TABLE_CALL];
 [receiveReq whereKey:PARSE_CALL_TO equalTo:usersPhone];
 [receiveReq whereKey:PARSE_CALL_STATUS equalTo:@"Request"];
  
 PFQuery *query = [PFQuery orQueryWithSubqueries:@[receive, sent, receiveReq]];

Open in new window


Thanks in advance for your help.
0
Comment
Question by:oo7ml
2 Comments
 
LVL 12

Accepted Solution

by:
KRUNAL TAILOR earned 500 total points
ID: 40228440
Hi oo7ml,

Have you requesting this PFQuery request in background?

See Here parse Doc: https://www.parse.com/docs/ios_guide#queries-compound/iOS

If so, try to put activity indicator so, it seems that your data is downloading, wait for that.

OR

Try Caching Queries request, Follow docs for parse here:https://www.parse.com/docs/ios_guide#queries-caching/iOS

Hope this will help you.
Thanks & Regards,
Krunal T. Tailor
0
 

Author Comment

by:oo7ml
ID: 40237461
Hi, thanks for your reply, and apologies for my late reply.

What would be a good way to trigger the messages to download, without clicking into the Inbox
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
A brief look into what is, how to use, and how to make GIFs
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now