Tag Archives: swift

POST with swift and API

Questions: I’ve a problem when I try to send a POST request to my API on my server, I’ve followed many many different tutorials but it still doesn’t work. I know than my problem is with the POST request but I can’t solve it ! So this is my code in Swift and my API… Read More »

Swiftmailer: Connection could not be established with host smtp.gmail.com [Connection timed out #110]

Questions: I’m posting because I’ve already gone through the solutions posted in other questions on here but they haven’t helped. What I am trying to do is send email using Swiftmailer through Google Apps for Business Gmail but I keep getting this error: Connection could not be established with host smtp.gmail.com [Connection timed out #110]… Read More »

Asynchronous encryption in Swift

Questions: I am trying to encrypt a string, using Public/Private Key system. I need to pass a string to the server, where a PHP script can decrypt it. I have a working JavaScript to PHP script system, however, I’d like to make it possible for the PHP script to also accept data from the iOS… Read More »

PHP, Swift-mailer problem

Questions: When I click submit button on my contact page, trying to submit a form that uses swift-mailer, I get this: Warning: fopen(uploads/) [function.fopen]: failed to open stream: No such file or directory in /home/polycys2/public_html/html/swift-mailer/lib/classes/Swift/ByteStream/FileByteStream.php on line 131 Fatal error: Uncaught exception ‘Swift_IoException’ with message ‘Unable to open file for reading [uploads/]’ in /home/polycys2/public_html/html/swift-mailer/lib/classes/Swift/ByteStream/FileByteStream.php:133 Stack… Read More »

Swift_TransportException Connection could not be established with host smtp.gmail.com

Questions: I can’t figure for the life of me why exactly is it failing.. this is the exact error I am getting: Fatal error: Uncaught exception ‘Swift_TransportException’ with message ‘Connection could not be established with host smtp.gmail.com [Connection refused #111]’ in /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php:259 Stack trace: #0 /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php(64): Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /home/content/38/6896038/html/test/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize(Array) #2 /home/content/38/6896038/html/test/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start() #3 /home/content/38/6896038/html/test/contact.php(55):… Read More »

trying to send mail using swift mailer, gmail smtp, php

Questions: Here is my code: <?php require_once ‘Swift/lib/swift_required.php’; $transport = Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465) ->setUsername(‘me@ff.com’) ->setPassword(‘pass’); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(‘Wonderful Subject’) ->setFrom(array(‘me@ff.com’ => ‘MY NAME’)) ->setTo(array(‘you@ss.com’ => ‘YOU’)) ->setBody(‘This is the text of the mail send by Swift using SMTP transport.’); //$attachment = Swift_Attachment::newInstance(file_get_contents(‘path/logo.png’), ‘logo.png’); //$message->attach($attachment); $numSent = $mailer->send($message); printf(“Sent %d messages\n”, $numSent); ?> AFter… Read More »

how to http post special chars in swift

Questions: I’m using the following to post an email and password to my server (php script). The problem I’m having is the password contains a special char (specifically the & symbol) which seems to be getting stripped. I presume because it thinks its separating variables being passed. How can I pass this char without it… Read More »

UIKeyboardWillShowNotification returning incorrect frame for swift keyboard

Questions: I am using UIKeyboardWillShowNotification and UIKeyboardWillHideNotification to handle keyboard. This is the function called when keyboard is shown : -(void) keyboardWillShow:(NSNotification *)note { CGRect keyboardBounds; //[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds]; NSValue* keyboardFrameBegin = [note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey]; keyboardBounds = [keyboardFrameBegin CGRectValue]; } I get keyboardBounds = (0, 524, 320, 44) and I am using 5s. No idea… Read More »

Swift: TableView in ViewController

Questions: I have a ViewController in the MainstoryBoard. I added the TableView to it. MainStoryBoard: In addition I have an array outside of the ViewController class and I want the objects inside the array to be shown in the TableView. I can’t figure out how to do it. I connected the delegate between the TableView… Read More »