简体   繁体   中英

How do I store user-inputed data so that it can be displayed to other users of an app?

I'm still fairly new to iOS development. My app is currently able to display run-time user-placed pins(for car dealerships) in a view controller, however as soon as the user exits the app or even the current map view, the pins disappear. Along with this, I plan to have it so that these user placed pins can be viewed by other users of the app.

So the question is, what program/framework (etc.) will best allow me to store these Pins with various user specific variables (such as NSStrings), so that I can load this data as soon as a specific view opens and display it to all other users of the app.

I've heard of Core Data and mySQL and other things, but I don't know enough about each of them to know which to use or if I actually need them at all.

Please give me guidance on what I should study/begin to use to accomplish this task.

Thank you!

You may use remote mySQL database and store your information there. You only need an iOS framework to access mySQL.

Also, you can write simple php script on your server which will do all work with mySQL database.

So do you need the pins to be able to be accessed on other devices or just that local device?

If it is just that local device than you can use something like NSUserDefaults to store an array of pin coordinates and just load those pins every time.

An example would look as follows:

[[NSUserDefaults standardUserDefaults] setObject:myArray forKey:@"myArray"]; 

and then you can access that with arrayForKey.

If you you are planning on having 1000s of pins then you may want to look at storing them in a SQLite database locally

Great tutorial for that here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM