Solved

Why Is This Taking So Long To Load

Posted on 2014-07-29
2
96 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

21 Experts available now in Live!

Get 1:1 Help Now