久久久久久久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 對(duì)用戶

        Need to authenticate a user using JSON on my server with iOS SDK(需要通過 iOS SDK 在我的服務(wù)器上使用 JSON 對(duì)用戶進(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 對(duì)用戶進(jìn)行身份驗(yàn)證的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我現(xiàn)在只在 iOS 應(yīng)用上工作了幾個(gè)星期,所以請(qǐng)耐心等待.我希望我的應(yīng)用程序的第一個(gè)屏幕是使用電子郵件地址和密碼登錄.我設(shè)置了視圖,但是我不確定存儲(chǔ)身份驗(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)用戶輸入他們的電子郵件和密碼時(shí),它將運(yùn)行連接到我的服務(wù)器并在失敗與否時(shí)返回 JSON.如果成功,我會(huì)返回我需要的任何東西.

                  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)該存儲(chǔ)哪些信息以及存儲(chǔ)在哪里?我應(yīng)該將他們的用戶 ID 和密碼存儲(chǔ)為 md5 字符串嗎?然后每次我調(diào)用服務(wù)器時(shí),我都可以傳遞他們的用戶 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ù)存儲(chǔ)在設(shè)備上.這樣,當(dāng)服務(wù)器上的會(huì)話過期時(shí),可以立即重新驗(yàn)證用戶.(請(qǐng)記住,這比每次都強(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.)

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

                  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.

                  順便說一句,您不必在每次請(qǐng)求時(shí)都將憑據(jù)傳遞給服務(wù)器.我不知道您在服務(wù)器端使用什么,但您可以將其設(shè)置為使用會(huì)話,因此他們的用戶將在必須重新驗(yàn)證之前停留一段時(shí)間.這是我用來發(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 對(duì)象將管理 cookie 并保持用戶登錄,因此您可以使用它繼續(xù)向服務(wù)器發(fā)送請(qǐng)求,直到會(huì)話過期.

                  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 對(duì)用戶進(jìn)行身份驗(yàn)證的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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>
                            主站蜘蛛池模板: 日韩一区二区三区av | 国产精品久久久久久 | 中国一级特黄真人毛片免费观看 | 在线视频中文字幕 | 成人免费视频网站 | 九七午夜剧场福利写真 | 在线观看中文字幕av | 欧美日韩一区在线 | 成人羞羞国产免费视频 | 免费在线观看一区二区 | 黄色一级免费观看 | 国产一区三区在线 | 色婷婷精品久久二区二区蜜臂av | 久久久成人精品 | 欧美一区二 | 91原创视频 | 欧美另类视频在线 | 黄色激情毛片 | 国产成人精品一区二区三区视频 | 欧美 中文字幕 | 毛片网在线观看 | av一级在线观看 | 综合伊人| 91精品久久久久久久久中文字幕 | 一级毛片免费看 | 一区二区高清 | 成人不卡视频 | 午夜看电影在线观看 | 日韩精品一区二区三区中文字幕 | 欧美一区视频 | 亚洲毛片 | 999热视频 | 六月色婷 | 久久久久国产精品一区二区 | 欧美视频二区 | 久久亚洲一区二区三区四区 | 国产日韩欧美一区 | 久久久久中文字幕 | 在线免费激情视频 | 97天天干 | 日本精品一区二区 |