久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='ILI5L'></bdo><ul id='ILI5L'></ul>

      1. <legend id='ILI5L'><style id='ILI5L'><dir id='ILI5L'><q id='ILI5L'></q></dir></style></legend>
      2. <i id='ILI5L'><tr id='ILI5L'><dt id='ILI5L'><q id='ILI5L'><span id='ILI5L'><b id='ILI5L'><form id='ILI5L'><ins id='ILI5L'></ins><ul id='ILI5L'></ul><sub id='ILI5L'></sub></form><legend id='ILI5L'></legend><bdo id='ILI5L'><pre id='ILI5L'><center id='ILI5L'></center></pre></bdo></b><th id='ILI5L'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ILI5L'><tfoot id='ILI5L'></tfoot><dl id='ILI5L'><fieldset id='ILI5L'></fieldset></dl></div>
        <tfoot id='ILI5L'></tfoot>

        <small id='ILI5L'></small><noframes id='ILI5L'>

      3. 需要通過 iOS SDK 在我的服務(wù)器上使用 JSON 對用戶

        Need to authenticate a user using JSON on my server with iOS SDK(需要通過 iOS SDK 在我的服務(wù)器上使用 JSON 對用戶進(jìn)行身份驗(yàn)證)
        1. <i id='Qn5zM'><tr id='Qn5zM'><dt id='Qn5zM'><q id='Qn5zM'><span id='Qn5zM'><b id='Qn5zM'><form id='Qn5zM'><ins id='Qn5zM'></ins><ul id='Qn5zM'></ul><sub id='Qn5zM'></sub></form><legend id='Qn5zM'></legend><bdo id='Qn5zM'><pre id='Qn5zM'><center id='Qn5zM'></center></pre></bdo></b><th id='Qn5zM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qn5zM'><tfoot id='Qn5zM'></tfoot><dl id='Qn5zM'><fieldset id='Qn5zM'></fieldset></dl></div>

              <tbody id='Qn5zM'></tbody>
            • <bdo id='Qn5zM'></bdo><ul id='Qn5zM'></ul>

                  <tfoot id='Qn5zM'></tfoot>

                  <small id='Qn5zM'></small><noframes id='Qn5zM'>

                1. <legend id='Qn5zM'><style id='Qn5zM'><dir id='Qn5zM'><q id='Qn5zM'></q></dir></style></legend>
                  本文介紹了需要通過 iOS SDK 在我的服務(wù)器上使用 JSON 對用戶進(jìn)行身份驗(yàn)證的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我現(xiàn)在只在 iOS 應(yīng)用上工作了幾個星期,所以請耐心等待.我希望我的應(yīng)用程序的第一個屏幕是使用電子郵件地址和密碼登錄.我設(shè)置了視圖,但是我不確定存儲身份驗(yàn)證的最佳方式是什么.

                  I've only been working on an iOS app now for a couple weeks so bear with me. I want my app's first screen to be a login with email address and password. I got the view set up however I'm just not sure what's the best way to store the authentication.

                  身份驗(yàn)證本身將在服務(wù)器端處理.當(dāng)用戶輸入他們的電子郵件和密碼時,它將運(yùn)行連接到我的服務(wù)器并在失敗與否時返回 JSON.如果成功,我會返回我需要的任何東西.

                  The authentication itself will be handled server side. When the user enters their email and password, it will run connect to my server and return JSON if it failed or not. If it is successful I will return whatever I need.

                  問題是,我應(yīng)該存儲哪些信息以及存儲在哪里?我應(yīng)該將他們的用戶 ID 和密碼存儲為 md5 字符串嗎?然后每次我調(diào)用服務(wù)器時,我都可以傳遞他們的用戶 ID 和 md5 字符串來驗(yàn)證他們是否有訪問權(quán)限.這樣做有意義嗎?

                  The question is, what information should I store and where do I store it? Should I store their user id and their password as a md5 string? Then every time I make a call to the server I can pass their user id and md5 string to verify if they have access. Does that make sense to do?

                  推薦答案

                  是的,您應(yīng)該將憑據(jù)存儲在設(shè)備上.這樣,當(dāng)服務(wù)器上的會話過期時,可以立即重新驗(yàn)證用戶.(請記住,這比每次都強(qiáng)制用戶登錄更不安全,因?yàn)槿绻脩魜G失了手機(jī),任何找到手機(jī)的人都可以訪問他的帳戶.)

                  Yes, you should store the credentials on the device. That way, when the session expires on the server, the user can be immediately re-authenticated. (Keep in mind, this is less secure than forcing the user to log in each time, because if the user looses his phone, anyone who finds it could have access to his account.)

                  只需將電子郵件地址和密碼存儲在 SQLite 表、plist、文本文件或您想要的任何內(nèi)容中.最好對密碼進(jìn)行加密,即使沒有其他應(yīng)用程序能夠訪問您存儲密碼的文件.

                  Just store the email address and password in an SQLite table, a plist, a text file, or whatever you want. It's probably best to encrypt the password, even though no other applications will be able to access the file you store it in.

                  順便說一句,您不必在每次請求時都將憑據(jù)傳遞給服務(wù)器.我不知道您在服務(wù)器端使用什么,但您可以將其設(shè)置為使用會話,因此他們的用戶將在必須重新驗(yàn)證之前停留一段時間.這是我用來發(fā)送憑據(jù)的一些代碼:

                  Btw, you don't necessarily have to pass the credentials to the server with every request. I don't know what you are using on the server side, but you can set it up to use sessions, so they user will stay longed in for a while before having to re-authenticate. Here is some code I have used to send credentials:

                  NSURLConnection *connection;
                  NSString *url = [NSString stringWithFormat:@"http://example.com/service/authenticate.ashx"];
                  NSString *username = [self.usernameField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                  NSString *password = [self.passwordField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                  NSMutableString* requestURL = [[NSMutableString alloc] initWithString:url];
                  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: [NSString stringWithString:requestURL]]];
                  [request setHTTPMethod: @"POST"];
                  [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
                  [request setHTTPBody:[[NSString stringWithFormat:@"username=%@&password=%@", username, password] dataUsingEncoding:NSUTF8StringEncoding]];
                  connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
                  

                  該 NSURLConnection 對象將管理 cookie 并保持用戶登錄,因此您可以使用它繼續(xù)向服務(wù)器發(fā)送請求,直到會話過期.

                  That NSURLConnection object will manage the cookie and keep the user logged in, so you can use it to keep sending requests to the server until the session expires.

                  這篇關(guān)于需要通過 iOS SDK 在我的服務(wù)器上使用 JSON 對用戶進(jìn)行身份驗(yàn)證的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當(dāng)前位置)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  CLLocation returning negative speed(CLLocation 返回負(fù)速度)
                  Locations in Core Data sorted by distance via NSFetchedResultsController?(通過 NSFetchedResultsController 按距離排序的核心數(shù)據(jù)中的位置?)
                  Swift: Geofencing / geolocations near user location(Swift:用戶位置附近的地理圍欄/地理位置)
                  How to get Location (latitude amp; longitude value) in variable on iOS?(如何在 iOS 上的變量中獲取位置(緯度和經(jīng)度值)?)
                    <tbody id='MNvvb'></tbody>

                      <small id='MNvvb'></small><noframes id='MNvvb'>

                            <bdo id='MNvvb'></bdo><ul id='MNvvb'></ul>

                            <tfoot id='MNvvb'></tfoot>
                          • <i id='MNvvb'><tr id='MNvvb'><dt id='MNvvb'><q id='MNvvb'><span id='MNvvb'><b id='MNvvb'><form id='MNvvb'><ins id='MNvvb'></ins><ul id='MNvvb'></ul><sub id='MNvvb'></sub></form><legend id='MNvvb'></legend><bdo id='MNvvb'><pre id='MNvvb'><center id='MNvvb'></center></pre></bdo></b><th id='MNvvb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='MNvvb'><tfoot id='MNvvb'></tfoot><dl id='MNvvb'><fieldset id='MNvvb'></fieldset></dl></div>

                            <legend id='MNvvb'><style id='MNvvb'><dir id='MNvvb'><q id='MNvvb'></q></dir></style></legend>
                            主站蜘蛛池模板: 奇米四色影视 | 国产福利在线视频 | 韩日中文字幕 | 国产成人精品一区二区三区在线 | 超碰人人插 | 在线观看黄视频 | 日韩国产中文字幕 | 久久新 | 中文字幕精品视频 | 国产福利一区二区 | 自拍视频一区二区三区 | 99精品在线 | 久久久www成人免费无遮挡大片 | 国产欧美日韩精品一区 | 日本男人天堂 | 国产精品91视频 | 超碰av人人| 91香蕉视频在线观看 | 中国黄色在线视频 | 亚洲va欧美va天堂v国产综合 | 伊人性伊人情综合网 | 毛片一区二区三区 | 国产精品1区| 日本不卡一区二区 | 亚洲第一天堂 | 97精品国产| 久久九七| 黑人巨大精品欧美一区二区一视频 | 亚洲精品乱码8久久久久久日本 | 天天拍天天操 | 久久久精品一区二区 | h视频免费观看 | 亚洲精品v日韩精品 | 国产黄色大片 | 亚洲视频二区 | 日韩美av| 亚洲91| 免费观看www | 亚洲天天干| 欧美视频精品 | 久久精品免费 |