{"action":"created","issue":{"url":"https://api.github.com/repos/uchicago-mobi/2015-Spring-Forum/issues/48","labels_url":"https://api.github.com/repos/uchicago-mobi/2015-Spring-Forum/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/uchicago-mobi/2015-Spring-Forum/issues/48/comments","events_url":"https://api.github.com/repos/uchicago-mobi/2015-Spring-Forum/issues/48/events","html_url":"https://github.com/uchicago-mobi/2015-Spring-Forum/issues/48","id":71131509,"number":48,"title":"deleting data on Parse","user":{"login":"xiaoyifan","id":9085563,"avatar_url":"https://avatars.githubusercontent.com/u/9085563?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaoyifan","html_url":"https://github.com/xiaoyifan","followers_url":"https://api.github.com/users/xiaoyifan/followers","following_url":"https://api.github.com/users/xiaoyifan/following{/other_user}","gists_url":"https://api.github.com/users/xiaoyifan/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaoyifan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaoyifan/subscriptions","organizations_url":"https://api.github.com/users/xiaoyifan/orgs","repos_url":"https://api.github.com/users/xiaoyifan/repos","events_url":"https://api.github.com/users/xiaoyifan/events{/privacy}","received_events_url":"https://api.github.com/users/xiaoyifan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-04-26T22:52:11Z","updated_at":"2015-04-27T00:30:26Z","closed_at":null,"body":"I'm trying to use both of Core data and Parse for data operation. Since I wanna fetch the data everytime when the app is launched, I wanna clean my database in viewDidLoad. the Core data did fine, but Parse would give me warning \"A long-running operation is being executed on the main thread\". I guess the right way would be using GCD or NSOperation to handle it in another thread, but deleting the data should be executed before new data downloading. Is there any suggestion on that? "},"comment":{"url":"https://api.github.com/repos/uchicago-mobi/2015-Spring-Forum/issues/comments/96451734","html_url":"https://github.com/uchicago-mobi/2015-Spring-Forum/issues/48#issuecomment-96451734","issue_url":"https://api.github.com/repos/uchicago-mobi/2015-Spring-Forum/issues/48","id":96451734,"user":{"login":"JRam13","id":3259292,"avatar_url":"https://avatars.githubusercontent.com/u/3259292?v=3","gravatar_id":"","url":"https://api.github.com/users/JRam13","html_url":"https://github.com/JRam13","followers_url":"https://api.github.com/users/JRam13/followers","following_url":"https://api.github.com/users/JRam13/following{/other_user}","gists_url":"https://api.github.com/users/JRam13/gists{/gist_id}","starred_url":"https://api.github.com/users/JRam13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JRam13/subscriptions","organizations_url":"https://api.github.com/users/JRam13/orgs","repos_url":"https://api.github.com/users/JRam13/repos","events_url":"https://api.github.com/users/JRam13/events{/privacy}","received_events_url":"https://api.github.com/users/JRam13/received_events","type":"User","site_admin":false},"created_at":"2015-04-27T00:30:26Z","updated_at":"2015-04-27T00:30:26Z","body":"Even easier:\r\n\r\n```objC\r\n-(void) deleteDataWithCompletion:(void (^)(BOOL success))completionBlock\r\n{\r\n    .\r\n    .\r\n    your query code\r\n    .\r\n    .\r\n\r\n    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {\r\n\r\n        if (error){\r\n            completionBlock(NO);\r\n            return;\r\n        }\r\n       \r\n         [PFObject deleteAllInBackground:objects block:^(BOOL succeeded, NSError *error) {\r\n            if(succeeded){\r\n                completionBlock(YES);\r\n            }\r\n            else{\r\n                completionBlock(NO);\r\n            }\r\n        }];\r\n    }];\r\n\r\n\r\n}"}}