18. 存在しないURLに接続しようとした
デリゲートの呼び出し結果
•
•
•
urlString = http://msyk1234.dyndns.org/
-[Communication URLSession:task:didCompleteWithError:]
[error] Error Domain=NSURLErrorDomain Code=-1003 "A
server with the specified hostname could not be found."
UserInfo=0xdb4fe70 {NSErrorFailingURLStringKey=http://
msyk.netxxxxx, NSErrorFailingURLKey=http://msyk.netxxxxx,
NSLocalizedDescription=A server with the specified hostname
could not be found., NSUnderlyingError=0x8d59160 "A
server with the specified hostname could not be found."}
We think...
•
•
13年10月18日金曜日
完了のメソッドだけがデリゲートされる
まあ、順当だろう
18
22. Appleのドキュメントにある認証のためのコード
-(void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([challenge previousFailureCount] == 0) {
NSURLCredential *newCredential;
newCredential
= [NSURLCredential credentialWithUser:[self preferencesName]
password:[self preferencesPassword]
persistence:NSURLCredentialPersistenceNone];
[[challenge sender] useCredential:newCredential
forAuthenticationChallenge:challenge];
} else {
[[challenge sender] cancelAuthenticationChallenge:challenge];
// inform the user that the user name and password
// in the preferences are incorrect
[self showPreferencesCredentialsAreIncorrectPanel:self];
}
}
13年10月18日金曜日
22