Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Cannot call method Add of undefined

$
0
0

Hello,

I am trying to make it so if a user is not logged in upon opening the app it redirects to login.xml, and if they are logged in from previous sessions, go to index.xml

var acs = require('acs');
 
acs.isLoggedIn(function(e){
    if(!e){
        alert("not logged in");
        var login = Alloy.createController('login');
        $.mainWin.add(login.getView());
    }else{
        alert("logged in");
        $.mainWin.add(index.getView());
    }
 
});
 
$.mainWin.open();
I am getting

V8Exception: Exception occurred at alloy/controllers/index.js:50: Uncaught TypeError: Cannot call method 'add' of undefined In the console, and GenyMotion gives me Cannot call method 'open' of undefined It is strange the location is alloy/controllers/index.js not app/controllers.index.js

When I run this I get the alert 'not logged in' then it fails so I know the logged in check is working correctly. I have tried different ways of opening the login view such as

if(!e){
        alert("not logged in");
        var login = Alloy.createController('login').getView();
        login.open();
    }
and others but none of them work.

This is mobile application. Titanium 3.5.0 (2015/01/12 15:33 0014f83) Android SDk 21 GenyMotion Samsung Galaxy S5 4.4.4 API 19 Windows 7.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>