ios에서 보안 URL에 액세스하려고합니다. 기본적으로 url은 사용자에게 Username과 Password를 요구합니다. ios에서 사용자 이름과 비밀번호를 보내려면 어떻게해야합니까?ios에서 보안 URL에 액세스하는 방법
내 코드 여기 내가 JSON 파서 여기에
- (NSString *)stringWithUrl:(NSURL *)url{
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReturnCacheDataElseLoad
timeoutInterval:30];
// Fetch the JSON response
NSData *urlData;
NSURLResponse *response;
NSError *error;
// Make synchronous request
urlData = [NSURLConnection sendSynchronousRequest:urlRequest
returningResponse:&response
error:&error];
// Construct a String around the Data from the response
return [[[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding] autorelease];}
- (id) objectWithUrl:(NSURL *)url{
SBJsonParser *jsonParser = [[[SBJsonParser alloc]init] autorelease];
NSString *jsonString = [self stringWithUrl:url];
// Parse the JSON into an Object
return [jsonParser objectWithString:jsonString error:nil]; }
를 액세스하는 데 사용하고 방법은 내 사전에 JSON 키를 검색하고있어 코드의 조각입니다.
- (NSDictionary *) downloadFeed {
id response = [self objectWithUrl:[NSURL URLWithString:@"http://mysite.com/Services/Secure.svc/GetList?id=2127"]];
NSDictionary *feed = (NSDictionary *)response;
return feed; }
누군가가 내가이 URL에 사용자 이름과 암호를 전달할 수있는 곳 알려주세요 수 있습니까?
어떤 의미로 프롬프트가 표시됩니까? 웹 사이트의 로그인 양식 또는 [기본 HTTP 인증] (http://en.wikipedia.org/wiki/Basic_access_authentication)? – Alex
기본 HTTP 인증, 더 명확한 그림을 얻기 위해 코드를 업데이트했습니다! – HardCode
'http : // user : [email protected]/...' –