Objective c 如何从ios访问安全url

Objective c 如何从ios访问安全url,objective-c,ios,Objective C,Ios,我正在尝试从ios访问安全url。基本上url会提示用户用户名和密码。如何从ios发送用户名和密码 我的代码 下面是我用来访问JSON解析器的方法 - (NSString *)stringWithUrl:(NSURL *)url{ NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturn

我正在尝试从ios访问安全url。基本上url会提示用户用户名和密码。如何从ios发送用户名和密码

我的代码 下面是我用来访问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吗?

切换到只处理基本身份验证的
ASIHTTPRequest
,或者使用
NSMutableRequest
并使用base64编码的user:Password对正确设置授权标头。

在什么意义上提示?网站上的登录表单,或者?基本HTTP身份验证,我更新了我的代码以获得更清晰的图片!放在这里:
http://user:passwd@mysite.com/…
我正在为我的登录控制器使用ASIHTTPRequest。但我在登录后使用JSON解析器。您认为在url上使用凭据不够安全吗?我会在发行版上使用HTTPS!我在哪里分配用户名和密码?NSURL*url=[NSURL URLWithString:@“http://@;ASIFormDataRequest*request=[ASIFormDataRequest requestWithURL:url];[request setRequestMethod:@“GET”];安全性是单独讨论:-).request.username=@“user”;request.password=@“password”“;-还有一个要设置的标志,用于强制请求在授权标头中设置基本身份验证。下面是该标志:request.authenticationScheme=(NSString*)kCFHTTPAuthenticationSchemeBasic;