2

Standard Parse.com setup directly from docs, gives warning "Warning: A long-running operation is being executed on the main thread. " Anybody else getting this?

Seems to be due to: [Parse enableLocalDatastore];

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

      [Parse enableLocalDatastore];

        // Initialize Parse.
        [Parse setApplicationId:@"APP_ID"
                      clientKey:@"CLIENT_ID"];

        // [Optional] Track statistics around application opens.
        [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];

    return YES;
    }

Now I could run this code using dispatch_async, I guess, except if I want to make a decision at startup based on whether the user is logged in or not. [PFUser *user=[PFUser currentUser]; completely crashes if I don't have [Parse enableLocalDatastore]; first. So maybe that is another bug or something.

How can their be this many problems doing the most basic things in Parse?

Fraggle
  • 8,607
  • 7
  • 54
  • 86
  • Where in your code are you using currentUser? Also are you checking if currentUser == nil before performing additional calls to the PFUser object? If it's nil you know the user isn't logged in yet. – Michael Grassman Dec 22 '14 at 01:12
  • I don't think the issue's coming from that line. Are you performing any Parse operations as soon as your first view loads? – Lyndsey Scott Dec 22 '14 at 01:53
  • @MichaelGrassman well the PFUser code I left out because that is probably a separate bug, that I discovered when commenting out the enableLocalDatastore line above. Basically if you call [PFUser currentUser] after the [PFAnalytics line, it causes the app to crash if you comment out the enableLocalDatastore line. – Fraggle Dec 22 '14 at 02:17
  • 2
    The warning disappears if I comment out enableLocalDatastore. I got the warning with the posted code as the ONLY parse code in the app. Straight from the documentation.https://parse.com/apps/quickstart#parse_data/mobile/ios/native/existing – Fraggle Dec 22 '14 at 02:19
  • Also this documentation leaves out 2 required frameworks which will cause the app not to build if done as they suggest: https://parse.com/apps/quickstart#parse_data/mobile/ios/native/existing – Fraggle Dec 22 '14 at 02:21
  • Other people have experienced this issue: http://stackoverflow.com/q/27462222/2274694 – Lyndsey Scott Dec 22 '14 at 02:29
  • Are you using the latest release 1.6.1. It looks like they address this issue. – Michael Grassman Dec 22 '14 at 04:07
  • @MichaelGrassman yes I'm using 1.6.1 – Fraggle Dec 22 '14 at 16:18
  • 1
    @Fraggle Were you able to figure out a way around this? – John Doe Dec 23 '14 at 06:42
  • @Fraggle were you able to figure this out? If so please answer the question – AndrewSB Jan 05 '15 at 08:00
  • No I haven't found a solution yet. Just leaving it as is for the moment, the warning doesn't seem to cause a problem at the moment, but still in early development stages for this app so hopefully it won't cause a problem down the road. – Fraggle Jan 05 '15 at 17:08

1 Answers1

0

The same bug reported here: https://developers.facebook.com/bugs/1537241009878763/
It will be fixed in the next Parse SDK release.

amudi
  • 136
  • 5