i have a serious bug that happens only at first install/launch of my Application.
The situation is this: i have a one-to-many relation on my PFInstallation object and i use the query associated with this relation to get all "user's" objects. This is working like a charm from the second launch of My App.
During the first launch i have this bug and i can't figure it out how to debug it.
Here's my query code: EDIT: i've updated this post so you can see the full PFInstallation + PFRelation + PFQuery asynchronous flow.
// Store the deviceToken in the current installation and save it to Parse.
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:devToken];
[currentInstallation setValue:deviceName forKey:@"deviceName"];
[currentInstallation setValue:deviceModel forKey:@"deviceModel"];
NSTimeZone *timeZone = [NSTimeZone localTimeZone];
NSString *tzName = timeZone.name;
NSNumber *secondsFromGMT = [NSNumber numberWithInteger:timeZone.secondsFromGMT];
[currentInstallation setValue:tzName forKey:@"timeZoneName"];
[currentInstallation setValue:secondsFromGMT forKey:@"secondsFromGMT"];
[currentInstallation saveInBackgroundWithBlock:^(BOOL succeed, NSError *error){
NSLog(@"Save installation: %s - error %@",succeed? "YES":"NO",error);
if (succeed && !error) {
if ([PFInstallation currentInstallation].objectId != nil){
PFQuery *query = [PFQuery queryWithClassName:@"Event"];
PFRelation *myEvents = [[PFInstallation currentInstallation]relationForKey:@"events"];
NSLog(@"Pf installation: %@ \nRelation: %@",[PFInstallation currentInstallation],myEvents.query);
query = myEvents.query;
query.cachePolicy = kPFCachePolicyCacheThenNetwork;
[query includeKey:@"Obs"];
[query includeKey:@"Category"];
[query orderByDescending:@"DateIni"];
[query setLimit:100];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
as you can see i already have a check if PFInstallation is saved or not...
debugger gets stuck at line:
0x1000b0e14: adrp x8, #1904640
and on thread one is stuck on process [PFQuery markAsRunning]
If i continue the run of my application it does not crash, if i redo the query i got the same error forever and it does not stops.
I kill the application and relaunch... everything works like a charm.
I know it's something like a PFInstallation local save bug, however i get the same PFinstallation log in the first launch of the app and the others.. PFInstallation seems to be saved correctly.
Maybe threading issue?
Anybody has experienced similar bug before?