1
votes

I am using this method to fetch objects from the parse in back ground

PFQuery *query = [PFQuery queryWithClassName:@"UserInfo" predicate:predicate];

NSPredicate *predicate; = [NSPredicate predicateWithFormat:@"useremail == %@",[dict objectForKey:@"form"]];

[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)

{

}];

Its producing the results but what i have to do is i have to stop the thread when i pop over from this class where i have implemented this code.

1

1 Answers

0
votes

It sounds like you want to cancel a query in progress if you are about to navigate away from the current view controller. There is - (void)cancel method of PFQuery that will take care of this:

https://www.parse.com/docs/ios/api/Classes/PFQuery.html#//api/name/cancel

Just make sure you keep a reference to this query and call it's cancel method in your UIViewController's - (void)viewWillDisappear:(BOOL)animated.