-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash AFTER trying to retrieve contents of directory from FTP #79
Comments
You get this error every time? |
Yes, unfortunately. : ( |
This sample code has a flaw. It does not retain |
Hi, thank you for the quick reply. I've tried to make it as an instance variable. The issue still persist. I'm sorry if I'm unfamiliar with the framework implementation. Below is the code of my whole controller. //
// ContentListingViewController.swift
//
import UIKit
import FilesProvider
class ContentListingViewController: UIViewController {
//MARK:- Variables
var host: HostBean?
var ftpFileProvider: FTPFileProvider?
//MARK:- Application Lifecycles
override func viewDidLoad() {
super.viewDidLoad()
if host != nil {
listDirectories()
}
}
//MARK:- Private Functions
private func listDirectories() {
let credential = URLCredential(user: (host?.username!)!, password: (host?.password!)!, persistence: .permanent)
ftpFileProvider?.delegate = self as FileProviderDelegate
ftpFileProvider = FTPFileProvider(baseURL: URL(string: (host?.serverUrl!)!)!, passive: true, credential: credential, cache: nil)
ftpFileProvider?.contentsOfDirectory(path: "/", completionHandler: { (contents, error) in
print(error)
for file in contents {
print("Name: \(file.name)")
print("Size: \(file.size)")
print("Creation Date: \(file.creationDate)")
print("Modification Date: \(file.modifiedDate)")
}
})
}
}
extension ContentListingViewController: FileProviderDelegate {
func fileproviderSucceed(_ fileProvider: FileProviderOperations, operation: FileOperationType) {
switch operation {
case .copy(source: let source, destination: let dest):
print("\(source) copied to \(dest).")
case .remove(path: let path):
print("\(path) has been deleted.")
default:
print("\(operation.actionDescription) from \(operation.source) to \(String(describing: operation.destination)) succeed")
}
}
func fileproviderFailed(_ fileProvider: FileProviderOperations, operation: FileOperationType, error: Error) {
switch operation {
case .copy(source: let source, destination: let dest):
print("copy of \(source) failed. huh? \(dest)")
case .remove:
print("file can't be deleted.")
default:
print("\(operation.actionDescription) from \(operation.source) to \(String(describing: operation.destination)) failed")
}
}
func fileproviderProgress(_ fileProvider: FileProviderOperations, operation: FileOperationType, progress: Float) {
switch operation {
case .copy(source: let source, destination: let dest):
print("Copy\(source) to \(dest): \(progress * 100) completed.")
default:
break
}
}
} |
My test unit is passing on my mac. My apps work well too. I cant reproduce :/ |
Hi, I've been trying a few public ftp server out there and try to find out if any of them is same with my own desktop ftp server. I've found a public ftp server which is ftp://speedtest.tele2.net/ (username: anonymous, no password), this ftp server caused the application to crash while others don't.. I don't understand why this is happening hope it helps. Edit : new crash error
|
The problem was zombie objects. Thanks for your report. |
Im having a similar crash. Using the example code for retrieving directory contents. I am retaining the FTPFileProvider. The crash happens immediately AFTER the completion block returns. The contents are retrieved properly then the app crashes with example code
|
@buba447 Please pull latest commit and check again |
Hi, I'm trying to list down the contents of directory from a ftp server.
iOS: 11.2
XCode: 9.2, Swift 4
Here is the crash error :
*** -[FilesProvider.FileProviderStreamTask respondsToSelector:]: message sent to deallocated instance 0x1c01c4ec0
Below is the code :
The text was updated successfully, but these errors were encountered: