• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by psykojello2 · Jul 13, 2015 at 09:37 PM · androidcoroutineasyncparseasynchronous

Async parse.com query not working on Android/iOS

When I try to make an asynchronous Parse.com request to fetch data, the task does not seem to get completed. T$$anonymous$$s works wit$$anonymous$$n the Unity Editor, but not when running on an Android or iOS device.

I had t$$anonymous$$s working until a few days ago, I re-arc$$anonymous$$tected my code a bit and been having trouble since then.

Here's my code snippet:

     public void GetFriendScores()
     {
         StartCoroutine (GetFriendsScoresCoroutine ());
     }
 
     IEnumerator GetFriendsScoresCoroutine()
     {
         Debug.Log("Started friends get scores coroutine");        
         
         //Assume these variables contain relevant information
         var ids = ............. (string list of facebook IDs)
                 
                 
         //Get a list of users who match the friend FB IDs
         var usersQuery = ParseObject.GetQuery ("FBUser").WhereContainedIn ("FB_ID", ids);
         
         //Use the user query result to find corresponding $$anonymous$$gh score rows
         var scoresQuery = ParseObject.GetQuery ("HiScores").WhereMatchesQuery ("User", usersQuery);
         var scoresQueryTask = scoresQuery.FindAsync ();
         
         Debug.Log("Started get scores task");
         w$$anonymous$$le (! (scoresQueryTask.IsCompleted))
             yield return null;
             
         Debug.List("Get scores task complete");
     }


The last line of Debug I see is "Started get scores task", and not$$anonymous$$ng after that.

When I run it in the editor, I get the correct data and the "Get Scores task complete" message.

Any idea what I might have missed? I'm using Parse 1.5.3 and can confirm that it was working before I re-wrote the code.

Comment
inxidious

People who like this

1 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image psykojello2 · Jul 17, 2015 at 05:43 PM 0
Share

After some more trial and error, here's what I noticed:

On iOS, the first time, it freezes at that line, but when I restart the app, it gets past the line.

On Android, it still doesn't go past the "Started get scores task" line, but the app doesn't freeze.

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by psykojello2 · Aug 10, 2015 at 01:36 AM

T$$anonymous$$s appears to be fixed with Parse 1.5.4

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by hakankaraduman · Jul 19, 2015 at 07:22 PM

any progress with the problem? I also have my app working on editor but not on android

Comment

People who like this

0 Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image psykojello2 · Jul 20, 2015 at 09:01 PM 0
Share

no luck yet. I recommend using ".continueWith()" instead of checking for IsCompleted. That's how I had it working before, but I needed to process the returned data in a loop and continueWith was not working for me. I might redo my code to work with continuewith.

avatar image hakankaraduman · Jul 20, 2015 at 09:02 PM 0
Share

yesterday I was searching for this and in some forum I found out that a lot of people had this problem.

Importing and using 1.3.2 version of Parse SDK solved my problem.

avatar image psykojello2 · Jul 20, 2015 at 09:11 PM 0
Share

Oh, good to know. I had to upgrade to 1.5.2+ because the older ones wouldn't not build on iOS with Unity 5. I might wait for a new patch.

avatar image hakankaraduman · Jul 20, 2015 at 09:12 PM 0
Share

Thanks for letting me know. I did not realize it since I make my tests on my Android phone.

avatar image $$anonymous$$ · Aug 05, 2015 at 08:02 AM 0
Share

Any updates on this one? on my end, this occurs after upgrading to parse to 1.5.3 D:

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to load scene when async.progress is 0.9? 0 Answers

How to make functions async? 2 Answers

StartCoroutine and Yield 0 Answers

Coroutine Stacking - Multiple calls into a coroutine 2 Answers

AsyncOperation activating immediately even with async.allowSceneActivation = false; 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges