Failed to find the images files on the device

69 Views Asked by At

I have this problem, where I need to list all files with a prefix to load it in a table, but when checking files in app directory, it didn't find them, only the files that are in the pictures

I moved folder Content, and select copy items if needed, and create a group for them.

I am running on Virtual machine, macOS sierra 10.12.6, XCode version 9.0 (9A235) Code Snippet

 func loadImages() -> Void{
    let fm = FileManager.default
    let path = Bundle.main.resourcePath!
    let items = try! fm.contentsOfDirectory(atPath: path)
    print(items)
    for item in items{
        if item.hasPrefix("nssl"){
            pictures.append(item)
        }
    }
}
1

There are 1 best solutions below

0
MUHSİN YILMAZ On

I faced the same problem. make sure selected "Create groups":

You have to be careful when choosing