xcode 应用用户账号注册和登录,最好的处理方式是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9645021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:34:48  来源:igfitidea点击:

Application users account registration and login, best way to handle?

iphoneobjective-csqliosxcode

提问by Yossi Tsafar

First of all, i'm new to Objective-C, so please be patient with me.

首先,我是Objective-C的新手,所以请耐心等待。

I want to add to my application users account management, users can register/log-in into a personal account that will synchronized with database on the internet. I dont have a clue how to do that. I know how to work with sqlite3. I was thinking maybe to create an sqlite3 database on the device. is it possible to store images into sqlite3 database? is it the best and efficient way to manage users on application?

我想添加到我的应用程序用户帐户管理,用户可以注册/登录到将与互联网上的数据库同步的个人帐户。我不知道如何做到这一点。我知道如何使用 sqlite3。我在想也许要在设备上创建一个 sqlite3 数据库。是否可以将图像存储到 sqlite3 数据库中?这是在应用程序上管理用户的最佳和有效方法吗?

what does sign in with Facebook or Twitter do? is it possible to add them both and another option for someone who doesn't have Facebook or Twitter?

使用 Facebook 或 Twitter 登录有什么作用?对于没有 Facebook 或 Twitter 的人,是否可以同时添加它们和另一个选项?

What is the best way to handle account registration and login on iPhone?

在 iPhone 上处理帐户注册和登录的最佳方式是什么?

Thanks alot!

非常感谢!

采纳答案by janusfidel

I want to add to my application users account management, users can register/log-in into a personal account that will synchronized with database on the internet.

我想添加到我的应用程序用户帐户管理,用户可以注册/登录到将与互联网上的数据库同步的个人帐户。

AFNetworkingor ASIHTTPRequestcan help you with this. create a web service api, maybe in php + mysql or any web scripting language you prefer, from the device you can POST your data like username and password and do the logic in your web service.

AFNetworkingASIHTTPRequest可以帮助您解决这个问题。创建一个 web 服务 api,可能是 php + mysql 或任何你喜欢的 web 脚本语言,你可以从设备上发布你的数据,比如用户名和密码,并在你的 web 服务中执行逻辑。

I was thinking maybe to create an sqlite3 database on the device. is it possible to store images into sqlite3 database?

我在想也许要在设备上创建一个 sqlite3 数据库。是否可以将图像存储到 sqlite3 数据库中?

what is your plan here? why would you create a database on the device? do you want to manage the users locally? if yes, that would be easier and more efficient because you dont need internet connection to create a requestto server. and yes its possible to store images in sqlite by storing the image as blob

你在这里有什么计划?为什么要在设备上创建数据库?你想在本地管理用户吗?如果是,那会更容易、更有效,因为您不需要互联网连接来创建request服务器。是的,可以通过将图像存储为 blob 来将图像存储在 sqlite 中

what does sign in with Facebook or Twitter do? is it possible to add them both and another option for someone who doesn't have Facebook or Twitter?

使用 Facebook 或 Twitter 登录有什么作用?对于没有 Facebook 或 Twitter 的人,是否可以同时添加它们和另一个选项?

Yes its possible. you can have three log in options. facebook, twitter, and your custom log in option. if you want to integrate facebook and twitter on your app. there are many tutorial and docs you can find there.
I suggest: this for facebookand download the sample app

是的,它可能。您可以有三个登录选项。facebook、twitter 和您的自定义登录选项。如果您想在您的应用程序中集成 facebook 和 twitter。您可以在那里找到许多教程和文档。
我建议:这适用于 facebook并下载示例应用程序

What is the best way to handle account registration and login on iPhone?

在 iPhone 上处理帐户注册和登录的最佳方式是什么?

it depends on your app requirement, if you dont need to store your user data in a database on a cloud server, the best way is to create a local database on device.

这取决于您的应用程序要求,如果您不需要将用户数据存储在云服务器上的数据库中,最好的方法是在设备上创建本地数据库。

回答by FluffulousChimp

This is a broad question - so the answer is going to be very general, little of which has to do with Objective-C, iOS, or Mac specifically.

这是一个广泛的问题 - 所以答案将非常笼统,其中与 Objective-C、iOS 或 Mac 没有什么特别关系。

It sounds like you are creating an application on a mobile device that needs to synchronize data with a database for which the mobile app is a client. One way of managing this is to start with table of users and credentials on your server, e.g. in MySQL. Then you need to write the API on the server side, e.g. in PHP, Rails, Python, etc. Then you will write the web service code on the device that interacts with the server's API.

听起来您正在移动设备上创建一个应用程序,该应用程序需要与移动应用程序作为客户端的数据库同步数据。管理它的一种方法是从服务器上的用户和凭据表开始,例如在 MySQL 中。然后您需要在服务器端编写API,例如用PHP、Rails、Python 等。然后您将在与服务器API 交互的设备上编写Web 服务代码。

If you are new to developing on iOS, then I would suggest running through some tutorials on consuming web services, first. That is, I would learn how to connect to pre-existing web services first. You might want to check out the AFNetworkinglibrary for Mac and iOS. It has some demo applications. But if you want to stick with the native URL loading system on iOS, there are numerous tutorials available. (Here's one)

如果您不熟悉在 iOS 上进行开发,那么我建议您先阅读一些有关使用 Web 服务的教程。也就是说,我将首先学习如何连接到预先存在的 Web 服务。您可能想查看适用于 Mac 和 iOS的AFNetworking库。它有一些演示应用程序。但是,如果您想坚持使用 iOS 上的本机 URL 加载系统,则有许多可用的教程。(这是一个

I should mention another option is to use Amazon Web Services SimpleDB. There is an iOS SDK. It allows you to execute queries directly against the db without writing the server-side code.

我应该提到另一种选择是使用 Amazon Web Services SimpleDB。有一个iOS SDK。它允许您直接对数据库执行查询,而无需编写服务器端代码。

You mentioned sqlite3. This will allow you to manage data on the device; but you state that you want to sync data with some resource on the internet. You can store images in sqlite3; but you can save yourself a lot of hassle by looking into Core Data as an alternative.

你提到了sqlite3。这将允许您管理设备上的数据;但是您声明要与 Internet 上的某些资源同步数据。你可以在sqlite3中存储图像;但是您可以通过将 Core Data 作为替代方案来为自己省去很多麻烦。