** iOS 개발을 처음 사용합니다. 수동으로 자격 증명을 전달하지 않고도 지정된 SharePoint 사이트 URL을 열 수있는 작은 응용 프로그램을 개발 중입니다. 열려고하는 URL에 자격 증명이 필요하지만 이러한 자격 증명을 UIWebView 컨트롤의 URL 열기 요청에 포함하고자합니다. Safari에서 URL을 열고 싶지 않습니다. UIWebView iPhone에서 SharePoint URL 열기 iPhone iOS XCode - 자격증 명 프롬프트가 표시되지 않도록 URL 요청에 자격 증명 포함
당신은 해결책을 찾는 데 좀 도와 주시겠습니까? **
0
A
답변
4
당신은 당신의 문제에 대한 -connection:didReceiveAuthenticationChallenge:
대리자를 사용할 수 있습니다. 먼저 보통 NSURLConnection
을 다음과 같이 작성하십시오.
- (void) someMethod
{
NSURLRequest* request = [[NSURLRequest alloc]
initWithURL:[NSURL urlWithString:@"Your sharepoint web url"]
NSURLConnection* connection = [[NSURLConnection alloc]
initWithRequest:request delegate:self];
[connection release];
[request release];
}
그런 다음 다시 전화를 받으십시오. 여기에서 자격 증명에 대한 도전을 처리해야합니다.
- (void) connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
// Make sure to use the appropriate authentication method for the server to
// which you are connecting.
if ([[challenge protectionSpace] authenticationMethod] ==
NSURLAuthenticationMethodBasicAuth)
{
// This is very, very important to check. Depending on how your
// security policies are setup, you could lock your user out of his
// or her account by trying to use the wrong credentials too many
// times in a row.
if ([challenge previousFailureCount] > 0)
{
[[challenge sender] cancelAuthenticationChallenge:challenge];
UIAlertView* alert = [[UIAlertView alloc]
initWithTitle:@"Invalid Credentials"
message:@"The credentials are invalid."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
else
{
[challenge useCredential:[NSURLCredential
credentialWithUser:@"someUser"
password:@"somePassword"
persistence:NSURLCredentialPersistenceForSession
forAuthenticationChallenge:challenge]];
}
}
else
{
// Do whatever you want here, for educational purposes,
// I'm just going to cancel the challenge
[[challenge sender] cancelAuthenticationChallenge:challenge];
}
}
업데이트 사용이 link이 코드입니다.
헤더 파일@interface yourViewController : UIViewController<UIWebViewDelegate>{
Bool _authed;
}
@property (강한 비 원자)의 UIWebView 함께 IBOutlet *의 웹보기에서
-(void)viewDidLoad{
NSString *strWebsiteUlr = [NSString stringWithFormat:@"http://www.roseindia.net"];
NSURL *url = [NSURL URLWithString:strWebsiteUlr];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[webview setDelegate:self]
}
;
관련 문제
- 1. 파일에서 UIWebView URL 열기
- 2. Safari에서 UIWebView URL 열기
- 3. iPhone : 잘못된 자격증 명 문제
- 4. 자격증 명 캐시
- 5. Xcode Webview URL 열기
- 6. iPhone : url 열기 Programmatically
- 7. 잘못된 자격증 명 symfony
- 8. WebClient 자격 증명 SharePoint Intranet
- 9. 심포니 - 자격증 명 문제
- 10. Jenkins의 SVN (Subversion) 자격증 명
- 11. iPad 용 다른 앱의 URL 열기 및 iPhone에서 비활성화 됨
- 12. 자격증 명 선택기의 암호
- 13. NodeJS로 iOS 푸시 알림 - 자격증 명
- 14. ChromeDriver에서 프록시 자격증 명 설정
- 15. iOS 코드에 API 자격 증명 포함
- 16. Chrome 자격증 명/스마트 잠금 팝업 : Chrome에
- 17. Grails 글로벌 저장소 자격증 명
- 18. iOS 앱에서 Safari에 자격증 명 전달
- 19. WWW :: Mechanize 자격 증명 사용
- 20. SaveFileDialog에서 SharePoint 자격 증명 받기
- 21. SharePoint 웹 서비스 자격 증명
- 22. Google 드라이브 자격증 명
- 23. iPhone에서 지원되는 RTSP URL
- 24. Phonegap_saving 사용자 자격증 명
- 25. 클로저 oauth 및 자격증 명
- 26. 자격 증명이있는 Windows 양식에서 URL 열기
- 27. 로그인 자격 증명 저장 Xcode
- 28. 배열 iOS SDK가있는 URL 열기
- 29. WCF + 사용자 자격증 명
- 30. Google 애널리틱스 자격증 명
안녕하세요. 답장을 보내 주셔서 감사합니다. 그러나 나는 어떻게 얻을 것인가 확신하지 못한다. (void) connection : (NSURLConnection *) connection didReceiveAuthenticationChallenge : (NSURLAuthenticationChallenge *) challenge code 내 코드에? 또한 ViewController있는 UIWebView 배치했습니다. 내 viewcontroller 클래스에 상속 또는 수퍼 클래스를 추가해야합니까? – GDroid
문제가되지 않습니다. UIWebview에서 사용할 수 있습니다. 이 링크를 확인하십시오 .http : //stackoverflow.com/questions/1769888/how-to-display-the-authentication-challenge-in-uiwebview –
샘플 코드로이 코드가있는 페이지 앱을 보내시겠습니까? 나는 정말로 오랫동안 고심하고있다 ... [email protected] – GDroid