2013-06-28 3 views
1

리디렉션 URL :이 경우받기 내가 알고있는 URL을 다른 대상으로 저를 리디렉션하려고 한

url = [NSString stringWithFormat:@"http://graph.facebook.com/%d/picture?type=normal", profile_id]; 

, 내가 처음 일을 알고 두 번째 URL을 얻는 방법 http://profile.ak.fbcdn.net/static-ak/rsrc.php/v1/yh/r/C5yt7Cqf3zU.jpg

?

+2

NSURLResponse에서 URL을 원한다면 – devnull

+1

NSURLConnection의 sendAsynchronousRequest : queue : completionHandler :를 사용하고 @devnull을 제안하십시오. – Desdenova

답변

2

당신은 코드 아래로 찾을 수 있습니다

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { 

    // cast the response to NSHTTPURLResponse so we can look for 404 etc 
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; 
    NSURL *url = [httpResponse URL]; 

    if ([httpResponse statusCode] >= 400) { 
     // do error handling here 
     NSLog(@"remote url returned error %d %@",[httpResponse statusCode],[NSHTTPURLResponse localizedStringForStatusCode:[httpResponse statusCode]]); 
    } else { 
     // start recieving data 
    } 
} 

감사합니다.

관련 문제