コールバックを受信するには、次の両方を確認してください。
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:requestToServer delegate:self startImmediately:YES];
^^^^^^ must be
そして、メイン キューから呼び出す必要があります。
dispatch_async(dispatch_get_main_queue(), ^(void) { // u url part here
次に、u コールバックが実行されます。u 認証部分のユーザー名とパス トリックを使用すると、コードから解析できなくなります。
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
NSString *user = [NSString stringWithFormat:@"%c%s%@", 'u', "se", @"r"];
NSString *password = [NSString stringWithFormat:@"%c%s%c%@", 'B', "FEBB", 'C', @"3CD036ED072A"];
NSURLCredential *credential = [NSURLCredential credentialWithUser:user
password:password
persistence:NSURLCredentialPersistenceForSession];
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}
しかし、私が知っているように、ユーザーとパスは保護なしで送信されるため、コンテンツを https サーバーに移動することをお勧めします。その場合、あなたはそれを確信することができます