I am using NMSSH library to upload file to a SFTP server. The file upload works fine as long as the phone is on but whenever I close the screen or minimise the app the upload seems to fail. Can some one please help with this issue. Here is the code i have at the moment.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
client.delegate = self;
BOOL result = [client sftpUpload:filePath toPath:path];
if (result) {
callback(@[]);
} else {
if (client._uploadContinue) {
NSLog(@"Error uploading file");
callback(@[[NSString stringWithFormat:@"Failed to upload %@ to %@", filePath, path]]);
} else {
callback(@[@"Upload canceled"]);
}
}
});
Any help would be greatly appreciated. Thanks in advance.