Ios gcdasyncsocketssl don';t连接

Ios gcdasyncsocketssl don';t连接,ios,cocoa,sockets,ssl,tcpclient,Ios,Cocoa,Sockets,Ssl,Tcpclient,我的套接字连接正常工作,但服务器已更新为SSL。我称这种方法为: [socket startTLS:nil]; 但是我仍然无法与服务器建立安全连接。我像这样启动连接: - (void) initNetworkCommunication { dispatch_queue_t mainQueue = dispatch_get_main_queue(); socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQ

我的套接字连接正常工作,但服务器已更新为SSL。我称这种方法为:

[socket startTLS:nil];
但是我仍然无法与服务器建立安全连接。我像这样启动连接:

- (void) initNetworkCommunication {

    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];

    NSError *err = nil;
    if (![socket connectToHost:@"192.168.2.210" onPort:1333 viaInterface:@"" withTimeout:-1 error:&err]) // Asynchronous!
    {
            // If there was an error, it's likely something like "already connected" or "no delegate set"
        NSLog(@"I goofed: %@", err);
    }else
    {
        NSLog(@"Connecting...");
    }
    [socket readDataWithTimeout:-1 tag:1];

}
- (void) initNetworkCommunication {

    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];

    NSError *err = nil;
    if (![socket connectToHost:@"192.168.2.210" onPort:1333 viaInterface:@"" withTimeout:-1 error:&err]) // Asynchronous!
    {
            // If there was an error, it's likely something like "already connected" or "no delegate set"
        NSLog(@"I goofed: %@", err);
    }else
    {
        [socket startTLS:nil];
        NSLog(@"Connecting...");

        }
        [socket readDataWithTimeout:-1 tag:1];

}

你能帮我一下吗?

在进行initNetworkCommunication之后,我正在调用[socket startTLS:nil],但应该是在我们建立连接的那一刻,如下所示:

- (void) initNetworkCommunication {

    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];

    NSError *err = nil;
    if (![socket connectToHost:@"192.168.2.210" onPort:1333 viaInterface:@"" withTimeout:-1 error:&err]) // Asynchronous!
    {
            // If there was an error, it's likely something like "already connected" or "no delegate set"
        NSLog(@"I goofed: %@", err);
    }else
    {
        NSLog(@"Connecting...");
    }
    [socket readDataWithTimeout:-1 tag:1];

}
- (void) initNetworkCommunication {

    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];

    NSError *err = nil;
    if (![socket connectToHost:@"192.168.2.210" onPort:1333 viaInterface:@"" withTimeout:-1 error:&err]) // Asynchronous!
    {
            // If there was an error, it's likely something like "already connected" or "no delegate set"
        NSLog(@"I goofed: %@", err);
    }else
    {
        [socket startTLS:nil];
        NSLog(@"Connecting...");

        }
        [socket readDataWithTimeout:-1 tag:1];

}