0

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.

Community
  • 1
  • 1
bobster
  • 301
  • 1
  • 3
  • 12
  • @MidhunMP 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. Would you mind giving some direction? – bobster Feb 11 '15 at 04:01
  • `The solution by using viewDidAppear does not help and the loginView will keep repeatedly showing up` What you mean by nonstop ? Is that showing many times when it opens or something else ? – Midhun MP Feb 11 '15 at 04:08
  • @MidhunMP Yes, the whole login pad just keeps on "animating" or "appearing" from the bottom of the screen. – bobster Feb 11 '15 at 05:03
  • Can you just give a sample app ? Or a video or something like that. The provided code is not enough to identify the mentioned issue – Midhun MP Feb 11 '15 at 05:40
  • @MidhunMP I'm sorry to ask silly question, my reputation is not enough to post anything but text. How do I share the project file with you? – bobster Feb 11 '15 at 07:19

0 Answers0