Click here to Skip to main content
15,890,043 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have implemented NSOPERATIONQUEUE By sending request and i can able to download response from server but the problem is i cant able to parallely process the sqlite to insert/update the response,i am getting Database Locked Error.So Can anyone suggest me a solution to work with database for insertion/updation of my downloded response??
Posted

1 solution

you must use GCD to run all databse commands in the main thread. It is a common pattern in ios to syncronize download and main thread.

C++
dispatch_async(dispatch_get_main_queue(), ^{
 // your do stuff
});


Here is a nice tutorial from Ray Wenderlich.
 
Share this answer
 
Comments
[no name] 18-Sep-15 1:00am    
Thanks for your reply,
can u tell me when dispatch_async gets completed ?, because i want to stop progress bar..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900