title: iOS: FTP TLS Connection
body: <p>I need a FTP TLS Connection for my iPhone-App. A normal FTP-Connection works fine. But I need also a secure TLS connection.
  I used the code from Apple´s SimpleFTPSample for the iPhone:</p>
  
  <pre><code>ftpStream = CFReadStreamCreateWithFTPURL(NULL, (CFURLRef) url);
  self.networkStream = (NSInputStream *) ftpStream;
  
  [self.networkStream retain];
  self.networkStream.delegate = self;
  
  
  CFReadStreamSetProperty((CFReadStreamRef)self.networkStream, kCFStreamPropertyFTPUserName, (CFStringRef)@"ftpuser");
  CFReadStreamSetProperty((CFReadStreamRef)self.networkStream, kCFStreamPropertyFTPPassword, (CFStringRef)myFTPPassWord);
  
  
  [self.networkStream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
  [self.networkStream open];
  </code></pre>
  
  <p>This works fine for a normal FTP Connection.</p>
  
  <p>But how do I setup a TLS Connection?
  I´m not sure what I need and if a TLS Connection works?</p>
  
  <p>I tried some code:</p>
  
  <pre><code>NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:5];
  [settings setObject:(NSString *)NSStreamSocketSecurityLevelTLSv1 forKey:(NSString *)kCFStreamSSLLevel];
  [settings setObject:[NSNumber numberWithBool:YES] forKey:(NSString *)kCFStreamSSLAllowsAnyRoot];
  CFReadStreamSetProperty((CFReadStreamRef)self.networkStream, kCFStreamPropertySSLSettings, (CFTypeRef)settings);
  </code></pre>
  
  <p>But without any success. Please can somebody help me.
  I need a FTP TLS Connection which is protected with a FTP Username and FTP Password.</p>
  
  <p>Thanks!</p>