开发者

how to fetch data from webserver and store to our database through SQLite

i开发者_JAVA技巧 want to fetch data from web server and save it in my local database through sqllite.How is it possible.


You can fetch data from webserver using JSON and webservice and then parse the JSON Response string.

Then you may create insert statements from the data obtained and execute it to insert in your database using executeNonQuery method of SQLite.

Best option is to do all this on appDidFinishLaunching so that there would be initial delay but then whole app after that would not face any performance issues i.e. No delays

Hope this helps you.


Well,

it depends on what kind of data you want to fetch. If you want to fetch XML from the webserver, you will get a nice list of xml parsers on this site: http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project

Another nice option for fetching any kind of data from the webserver is curl. You can find static libraries on this page: http://code.google.com/p/ios-static-libraries/

Well, there's always the option to use the iOS native libraries, which are documented (with examples) in the iOS SDK.


I would not recommend using "raw" SQLite these days unless you have an exceptional reason to do so. Core Data is the way forward.

I'm not really sure what your question is; it's so broad. But, in general, you'd create an NSURLConnection, download the data, parse the data and store it in your database. Each stage is pretty well documented and there are lots of questions here on each stage.

If you use Core Data there are also some open source projects, such as RestKit, that might give you a good starting point.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜