मैं चाहता हूं कि मेरा आवेदन उपकरण के खिलाफ प्रमाणित करने के लिए i.e https पर उपयोगकर्ता नाम और पासवर्ड पास कर रहा हो।आईओएस https प्रमाणीकरण
मैं कुछ उदाहरण को देखा और मूल रूप से निम्नलिखित का निर्माण:
-(void)authentication
{
//setting the string of the url taking from appliance IP.
NSString *urlString =[NSString
stringWithFormat:
@"http://%@",appliance_IP.text];
//define the url with the string
NSURL *url = [NSURL URLWithString:urlString];
//creating request
NSURLRequest *request = [NSURLRequest requestWithURL:url];
//setting credential taking from the username and password field
NSURLCredential *credential = [NSURLCredential credentialWithUser:username.text password:password.text persistence:NSURLCredentialPersistenceForSession];
NSURLProtectionSpace *protectionSpace=
[[NSURLProtectionSpace alloc]initWithHost:urlString port:443 protocol:@"https" realm:nil authenticationMethod:nil ];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace];
[ NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:NULL];
}
के रूप में मैं जो मैं ले लिया मैं कुछ और समझ की जरूरत है उदाहरण का उपयोग करें, NSURLConnection उदाहरण में ऊपर यूज़रनेम और पासवर्ड मैं कैसे कर शामिल नहीं है इसे जोड़ें ? इसलिए अनुरोध में उपयोगकर्ता नाम और पासवर्ड भी होगा या शायद उस जानकारी को पास करने के लिए बेहतर होगा। वर्तमान में अनुरोध में केवल यूआरएल स्ट्रिंग है।
धन्यवाद ईआर