简体   繁体   English

如何存储用户输入的数据,以便可以将其显示给应用程序的其他用户?

[英]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. 我对iOS开发还是很陌生。 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. 所以问题是,哪种程序/框架(等等)最能使我将这些Pin与各种用户特定的变量(例如NSStrings)一起存储,以便我可以在特定视图打开后立即加载此数据并将其显示给该应用程序的所有其他用户。

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. 我听说过Core Data和mySQL以及其他内容,但是我对它们每个人都不了解,因此根本不知道该使用哪个。

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. 您可以使用远程mySQL数据库并将信息存储在该数据库中。 You only need an iOS framework to access mySQL. 您只需要一个iOS框架即可访问mySQL。

Also, you can write simple php script on your server which will do all work with mySQL database. 另外,您可以在服务器上编写简单的PHP脚本,该脚本可以与mySQL数据库一起使用。

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. 如果仅仅是本地设备,则可以使用NSUserDefaults之类的东西来存储引脚坐标数组,并每次都加载这些引脚。

An example would look as follows: 一个示例如下所示:

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

and then you can access that with arrayForKey. 然后您可以使用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 如果您打算使用数千个引脚,那么您可能需要考虑将它们存储在本地的SQLite数据库中

Great tutorial for that here 很棒的教程在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 除了显示所有用户的用户数据外,如何只显示喜欢已登录用户的人的数据? - Instead of displaying the user data of all users, how can the data of only the people who liked the logged in user be displayed? 如何使用 Xcode 11 和 swift 从一组用户输入的 Ints 中找到 Max - How do I find the Max from a group of user inputed Ints using Xcode 11 and swift 登录后如何存储用户数据以在整个应用程序中使用? - How do I store user data once logged in to be used throughout the app? iOS / Windows Store应用程序:我可以知道我的其他应用程序是否已安装在此设备/用户帐户上吗? - iOS / Windows Store App: can I know whether my other app installed on this device/user account? OS X,钥匙串。 存储只能由我的应用程序更改的数据,而不能由用户或其他应用程序更改 - OS X, keychain. store data that can be only changed by my app, not by user, or other app iOS 开发:如何对我的应用程序进行更改以使其仅影响新用户? - iOS Development: How can I make changes to my app so that it only affects new users? 如何允许我的用户在应用商店之外下载我的 ios 应用? - How can I allow my users to download my ios app outside the app store? 如何存储数据(来自文本字段的用户输入) - How do I store data (user input from a textfield) 如何通过 App Store 将数据传递到下载的应用程序? - How can I pass data through the App Store to a downloaded app? Swift:如何存储数组数据,以便在离开课程后可以多次访问它? - Swift: How can I store array data, so it can be accessed more than once after leaving class?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM