marmelroy / FileBrowser

Finder-style iOS file browser written in Swift
MIT License
1.52k stars 222 forks source link

Not working with Xcode 7.3.1 ! #11

Closed indrajitsinh closed 8 years ago

indrajitsinh commented 8 years ago

Display just blank screen and below warning

2016-06-28 20:52:04.797 FIleBrowserDemo[2533:43383] Warning: Attempt to present <FileBrowser.FileBrowser: 0x7fbe4b849a00> on <FIleBrowserDemo.ViewController: 0x7fbe4a5a9230> whose view is not in the window hierarchy!

simulator screen shot 28-jun-2016 8 53 58 pm

import UIKit import FileBrowser

class ViewController: UIViewController {

let fileBrowser = FileBrowser()
override func viewDidLoad() {
    super.viewDidLoad()

    self.presentViewController(fileBrowser, animated: true, completion: nil)
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

marmelroy commented 8 years ago

Hi @indrajitsinh, I believe you are trying to present too early. As the error says, the view is not yet in the hierarchy when ViewDidLoad is called. You should present the file browser at a later view controller delegate (e.g. viewDidAppear) or in reaction to a button press.

Hope that helps, Roy