I have an Android app I wrote that uses a sqllite database, now I am writing the same app for iPhone. How do I use the existing sqllite database from my android app in the iPhone version?
More specific questions:
Where do I place the actual sqllite database - What folder?
Can I just use iPhone sql statements to open and read the data?
Could I just use an xcode emulator until I move the iPhone app to an actual device?
If you're happy with using sql, you don't necessarily need to go through the CoreData pain barrier. Ray Wenderlich also has a good tutorial on using Sqlite directly in your app here:
Part 1 - SQLite 101 for iPhone Developers (Intro)
Part 2 - SQLite 101 for iPhone Developers (The actual coding with Sqlite)
His site is a great resource for experienced developers wanting a quick and practical guide to getting started with almost every aspect of iOS development imaginable.
Here you can find a tutorial about how to import a SQLite Databse to core data:
How To Preload and Import Existing Data
Related
I have a SQLite database that I want my app to read and load into a UITableView then push to a Detail View.
I am using the FMDB wrapper framework (https://github.com/ccgus/fmdb). I'm confused as to how exactly to do this as I've never used SQLite in an iPhone app before.
Can anyone help get me started? What code do I need to add to I'm assuming viewDidLoad?
I think you should use CoreData framework provided in iPhone SDK. Its pretty simple to use and it manages most of the complex things for us. It provides a way to use Sqlite database as a persistent store for your application. You can just start with it from the documentation provided in iPhone SDK documentation under "Core Data Programming guide" section.
Could please share a simple program(or link) to understand core data in iPhone. The program should cover add & delete a entry in table view. Program without IB is preferable.
Thank you
Read the blog on CoreData from apple
Building a Sample Core Data Application
Read more
Cocoa Dev Central . Articles . Build a Core Data App
iPhone Core Data: Your First Steps
Core Data Tutorial: Getting Started
Have you read through the core data programming guide on the Apple Developer center? link
Take a look at the Stanford iPhone development course, in particular lecture 12
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2010-fall
Apple also have a lot of sample code in the developer program, including an excellent introduction to core data http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008305
Open Xcode
File -> New Project
iOS or Mac App, you choose
Select the App Type (Master-Detail, etc) again, you choose
Choose Next
Give it a name, company identifier
Check the box next to "Use CoreData"
Choose Next
Find a home on the file system for your new app (~/Documents will work just fine)
Choose Create
Open [Your App Name]AppDelegate.m and notice that Xcode wrote all the coredata scaffolding for you!
I was also looking for simple example regarding this but unfortunately could not found which tells me straight forward. Here is what I have prepared. It is very basic example iOS project, shows only save and retrieve data in SQLite using pure Core Data framework.
http://www.iosmobileapps.biz/examples/CoreDataEx.zip
Hope you will find this useful.
What is the best way to store data for the iPhone? I will be developing an iPhone app in Objective-C which will take data from end users. This data will need to be save and loaded at various points.
Essentially, what is the best combination of languages and frameworks to use in order to develop the above (i.e. should I be aware of any compatibility or like issues regarding the objective-c language)?
EDIT: Are there any particular reasons why to choose sqllite over core data?
Hey, the best way to store and manage data is Core Data framework, you can read about it in official docs.
Two of the most popular and reasonable solutions:
Apple's native solution: CoreData
sqlite3
I used sqlite3 for my applications. If you use mySQL then you'll be very comfortable to use sqlite3. However, people recommend CoreData due to its ease of use and iOS support.
I would also like to add my vote for the CoreData solution. I investigated all the options (CoreData, sqlite3 and plists) and CoreData seemed to be the right option for me.
I found a brilliant tutorial on it for iOS 5 here
we have an app which is available for ipad, iphone, android as well as samsung bada. since all of these platforms support sqlite, this app makes extensive use of sqlite for saving and reading data.
we now face quite a lot of issues whenever we need to update our app, that is punch in the same data access code across 4 different apps. we might also be looking to publish this app for windows mobile at a future date
i was wondering if there is a way to atleast have a completely independent library to manage our data access part so that we can just code and update this library once and simply use it across all 4 platforms
it would be awesome to achieve that and it would save us plenty of hours of coding and debugging and testing
No, because what you are asking for is essentially a SQL client layer sitting on top of SQLite similar to Oracle's SQL Client for Linux, Windows and so on that sits on top of the Oracle DB server that a developer could code to. This SQL client layer would have to define a standard interface (think JDBC or ODBC) and be implemented in Java (Android), C#, VB, and F# (Windows Mobile 7), and Objective-C (iOS).
Having said that, do I expect to see such a chunk of software developing over time, considering that SQLite does seem to be the defacto standard on handsets? Yes, I would expect to see something pop up on Git somewhere in the future that does something like that.
I am planning to develop an iPhone application heavily relying on sqlite DB ,
from different links I have gone through this seems to be a great tool and has some really good support.
As my app is still in the planning process
I would like to ask if there are any Issues with SQLlite database ? from memory management to Queries and data sizes and multiple access etc;
Please share your experience using SQLite DB in iPhone and what problems did you face?
I just want to make a note of these exceptions so that I may plan my App well and do not have any issues raised in the middle of the development process.
Thanx for your contribution.
If you are not looking to support the OS version 2.x or below I would (as the apple and may be the other developers) suggest to use the core-data. Its a lot simpler and easy to handle than sqlite. See the apple support and this sample for more help.
Thanks,
Madhup