ios - Bypass Login View if Parse User is Logged In -


i trying create function upon app launch, app checks see if there parse user logged in, , if true, user should bypass login screen , taken view located within tabbed view controller. if there not user logged in, open login view, opens on app load default. took crack @ functionality creating if statement within viewwillappear function on login view , if true, instantiateviewcontrollerwithidentifier(), app crashes due no identifier name.

reason: 'storyboard (<uistoryboard: 0x7ffbf3e82190>) doesn't contain view controller identifier 'profilesettingsviewcontroller' 

now might missing something, set identifier view controller? or class name identifier assume?

in related question, best way achieve looking do?

here login controller logic:

override func viewwillappear(animated: bool) {          var currentuser = pfuser.currentuser()          if currentuser != nil {            self.storyboard?.instantiateviewcontrollerwithidentifier("profilesettingsviewcontroller")            }         } 

here view should open if user logged in profilesettingsviewcontroller.swift:

import uikit  class profilesettingsviewcontroller: uiviewcontroller {      override func viewwillappear(animated: bool) {         self.tabbarcontroller?.navigationitem.sethidesbackbutton(true, animated:true);          //self.tabbarcontroller?.navigationitem.title = "profile settings"         self.navigationcontroller?.navigationitem.title = "ffff"     }      override func viewdidload() {         super.viewdidload()     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }      @ibaction func logoutbutton(sender: anyobject) {         pfuser.logout()         var currentuser = pfuser.currentuser()         self.performseguewithidentifier("userloggedout", sender: self)         self.navigationcontroller?.setnavigationbarhidden(self.navigationcontroller?.navigationbarhidden == false, animated: true)      }      /*     // mark: - navigation      // in storyboard-based application, want little preparation before navigation     override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {         // new view controller using segue.destinationviewcontroller.         // pass selected object new view controller.     }     */  } 

i haven't used parse before, authorization let appdelegate take care of initial view controller.

// member variables var storyboard : uistoryboard?;  func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool {      self.storyboard = uistoryboard(name: "main", bundle: nsbundle.mainbundle());     var currentuser = pfuser.currentuser()     if currentuser != nil {         self.window?.rootviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("profilesettingsviewcontroller");     }      return true; } 

i pretty sure work inside view controller because in code, didn't assign instantiated controller root view controller. however, think appdelegate should take care of changing root view controller, not uiviewcontrollers.

edit: sorry, forgot mention error. go storyboard , click on profilesettingsviewcontroller , go 3rd tab in sidebar , there storyboard id. set name "profilesettingsviewcontroller" (or whatever want) , find controller. uistoryboard.instantiateviewcontrollerwithidentifier searches storyboard controller given storyboard id.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -