• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

Why Is This Taking So Long To Load

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
oo7ml
Asked:
oo7ml
1 Solution
 
KRUNAL TAILORFreelance Mobile DeveloperCommented:
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
 
oo7mlAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now