I am using Gold Raccoon in my swift project. My swift code builds and runs fine but when I check on the FTP Server there is no file. This is the code which I am using in viewDidload()
var ftpRequest:GRRequestsManager!
var path = NSBundle.mainBundle().pathForResource("marker", ofType: ".png")
ftpRequest = GRRequestsManager(hostname: "192.x.x.x", user: "xx", password: "xxxx")
ftpRequest.addRequestForUploadFileAtLocalPath(path, toRemotePath: "/marker.png")
self.ftpRequest.startProcessingRequests()
Then I tried to check whether my file is successully uploaded or not by using delegate of GRRequestsManager ftpRequest.delegate = self
in viewDidload().
and wrote these delegate functions in my swift class by conforming with
GRRequestsManagerDelegate protocol.
func requestsManager(requestsManager: GRRequestsManagerProtocol!, didCompleteUploadRequest request: GRDataExchangeRequestProtocol!) {
print("did Complete Upload Request")
}
func requestsManager(requestsManager: GRRequestsManagerProtocol!, didFailRequest request: GRRequestProtocol!, withError error: NSError!) {
print("did Fail Request")
}
when I compile its fine but when I run the code xcode gives me an error on this line ftpRequest.delegate = self
unexpectedly found nil
I cannot upload my .png file to the FTP Server. Allover the internet that I found is about Obj-C but NO swift code to do this.
Is there any swift way to do this?
Please guide me If I am doing wrong. Or provide any running sample code that uploads the .png file to the FTP Server with Authentication(should require username and password)
NOTE: I am using Briding Header to use GoldRaccoon (as it is available only in Objective-C)
Finally my problem is solved I just used Rebekka Touch framework which is a swift framework. Its is easy to use and really a very good thing.