I have looked through other Question on SOF, they are close to my issue but not exactly the same.
I"m trying to load ParseUI by subclassing PFLogInViewController
with MyLogInViewController
, I use viewDidLoad
but the animation is not showing (since it is already loaded I supposed) and the window hierarchy warning below shows up. Then I tried viewDidAppear
but the loginView now repeatedly showing up nonstop. (Maybe because of the view keeps appearing?)
I tried viewWillApear
, animation did't work.
Warning: Attempt to present <myloginbeta1.MyLogInViewController: 0x7fa0185f0b30> on <myloginbeta1.MyLogInViewController: 0x7fa0185d4110> whose view is not in the window hierarchy!
I tried viewWillLayoutSubviews
, nonstop repeating.
I tried viewDidLayoutSubviews
, animation didn't work.
Warning: Attempt to present <myloginbeta1.MyLogInViewController: 0x7fa0185f0b30> on <myloginbeta1.MyLogInViewController: 0x7fa0185d4110> whose view is not in the window hierarchy!
Is there anywhere I should try with the animation properly come up and no warning message?
Here is my code:
import UIKit
import ParseUI
class MyLogInViewController: PFLogInViewController, PFLogInViewControllerDelegate, FBLoginViewDelegate, PFSignUpViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
//This func works with warning below and the animation part is not working since it is called before the view appear.
//Warning: Attempt to present <myloginbeta1.MyLogInViewController: 0x7fa0185f0b30> on <myloginbeta1.MyLogInViewController: 0x7fa0185d4110> whose view is not in the window hierarchy!
// Do any additional setup after loading the view.
}
override func viewDidAppear(animated: Bool) {
//This func doesn't work, viewDidAppear will keep repeating
}
override func viewWillAppear(animated: Bool) {
//This func works but the animation part is not working since it is called before the view appear.
self.view.backgroundColor = UIColor(red: 241/255.0, green: 224/255.0, blue: 174/255.0, alpha: 1.0)
var logInController:MyLogInViewController = MyLogInViewController()
logInController.fields = (PFLogInFields.UsernameAndPassword
| PFLogInFields.LogInButton
| PFLogInFields.SignUpButton
| PFLogInFields.PasswordForgotten
| PFLogInFields.DismissButton
| PFLogInFields.Facebook
| PFLogInFields.Twitter)
logInController.delegate = self
logInController.facebookPermissions = ["public_profile", "email", "user_friends"]
let logoView = UIImageView(image: UIImage(named:"logo.png"))
self.logInView.logo = logoView
self.presentViewController(logInController, animated:true, completion: nil)
}
func logInViewController(controller: MyLogInViewController, didLogInUser user: PFUser!) -> Void {
self.dismissViewControllerAnimated(true, completion: nil)
println("Login Successful")
}
func logInViewControllerDidCancelLogIn(controller: MyLogInViewController) -> Void {
self.dismissViewControllerAnimated(true, completion: nil)
}
Thanks and any help would be appreciated! :-)
Updated: I have checked whose view is not in the window hierarchy before I post this question. The solution by using viewDidAppear does not help and the loginView will keep repeatedly showing up.