Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Textfields are crashing my app

Textfields are crashing my app. I've updated to Ti SDK 1.4 but this was happening prior to updating. If I remove the textfield the window opens just fine.

Thx

This code…

var projs = Ti.UI.createWindow({
    url: 'sc-files/login.js',
    title: 'Projects',
    shadowColor:'#000',
    shadowOffset:{x:1,y:1},
    color: '#1c1d1c',
    barColor: '#333'
});

Opens this page (sc-files/login.js):

var login = Ti.UI.currentWindow;

var form = Ti.UI.createView({
    backgroundColor: 'pink',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0
});

login.add(form);

var tf1 = Ti.UI.createTextfield({
    color:'#336699',
    value: 'Username',
    height:30,
    width:300,
    top:10,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    keyboardToolbar: false,
    keyboardToolbarHeight: 40,
    returnKeyType: Titanium.UI.RETURNKEY_DONE
});

form.add(tf1);

Which then crashes immediately with this error:

[WARN] attempted to load: TiUITextfieldProxy
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x0366e8fc __exceptionPreprocess + 156
1 libobjc.A.dylib 0x037bc5de objc_exception_throw + 47
2 statuscheck 0x000a7c3d -[TiModule createProxy:forName:context:] + 768
3 CoreFoundation 0x035df42d __invoking___ + 29
4 CoreFoundation 0x035df301 -[NSInvocation invoke] + 145
5 statuscheck 0x00046781 -[KrollMethod call:] + 736
6 statuscheck 0x0004607f KrollCallAsFunction + 327
7 statuscheck 0x00257586 _ZN2TI16TiCallbackObjectINS_8TiObjectEE4callEPNS_10TiExcStateEPS1_NS_7TiValueERKNS_7ArgListE + 550
8 statuscheck 0x002223ed cti_op_call_NotTiFunction + 637
9 ??? 0x07d78506 0x0 + 131564806
10 statuscheck 0x001cf8f1 _ZN2TI11Interpreter7executeEPNS_17ProgramExecutableEPNS_10TiExcStateEPNS_14ScopeChainNodeEPNS_8TiObjectEPNS_7TiValueE + 593
11 statuscheck 0x0018beb4 _ZN2TI8evaluateEPNS_10TiExcStateERNS_10ScopeChainERKNS_10SourceCodeENS_7TiValueE + 468
12 statuscheck 0x00233544 TiEvalScript + 388
13 statuscheck 0x000411a4 -[KrollBridge evalFileOnThread:context:] + 1761
14 statuscheck 0x00043667 -[KrollInvocation invoke:] + 118
15 statuscheck 0x00042967 -[KrollContext invokeOnThread:method:withObject:callback:selector:] + 187
16 statuscheck 0x0003f167 -[KrollBridge evalFile:callback:selector:] + 97
17 statuscheck 0x00040885 -[KrollBridge didStartNewContext:] + 1444
18 statuscheck 0x00043b8f -[KrollContext main] + 1102
19 Foundation 0x005922a8 -[NSThread main] + 81
20 Foundation 0x00592234 __NSThread__main__ + 1387
21 libSystem.B.dylib 0x93b13a19 _pthread_start + 345
22 libSystem.B.dylib 0x93b1389e thread_start + 34
2010-07-28 12:39:09.942 statuscheck[52240:6803] *** Terminating app due to uncaught exception 'org.statuscheck.module', reason: 'invalid method (createTextfield) passed to UIModule'
*** Call stack at first throw:
(
0 CoreFoundation 0x0366e919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x037bc5de objc_exception_throw + 47
2 statuscheck 0x000a7c3d -[TiModule createProxy:forName:context:] + 768
3 CoreFoundation 0x035df42d __invoking___ + 29
4 CoreFoundation 0x035df301 -[NSInvocation invoke] + 145
5 statuscheck 0x00046781 -[KrollMethod call:] + 736
6 statuscheck 0x0004607f KrollCallAsFunction + 327
7 statuscheck 0x00257586 _ZN2TI16TiCallbackObjectINS_8TiObjectEE4callEPNS_10TiExcStateEPS1_NS_7TiValueERKNS_7ArgListE + 550
8 statuscheck 0x002223ed cti_op_call_NotTiFunction + 637
9 ??? 0x07d78506 0x0 + 131564806
10 statuscheck 0x001cf8f1 _ZN2TI11Interpreter7executeEPNS_17ProgramExecutableEPNS_10TiExcStateEPNS_14ScopeChainNodeEPNS_8TiObjectEPNS_7TiValueE + 593
11 statuscheck 0x0018beb4 _ZN2TI8evaluateEPNS_10TiExcStateERNS_10ScopeChainERKNS_10SourceCodeENS_7TiValueE + 468
12 statuscheck 0x00233544 TiEvalScript + 388
13 statuscheck 0x000411a4 -[KrollBridge evalFileOnThread:context:] + 1761
14 statuscheck 0x00043667 -[KrollInvocation invoke:] + 118
15 statuscheck 0x00042967 -[KrollContext invokeOnThread:method:withObject:callback:selector:] + 187
16 statuscheck 0x0003f167 -[KrollBridge evalFile:callback:selector:] + 97
17 statuscheck 0x00040885 -[KrollBridge didStartNewContext:] + 1444
18 statuscheck 0x00043b8f -[KrollContext main] + 1102
19 Foundation 0x005922a8 -[NSThread main] + 81
20 Foundation 0x00592234 __NSThread__main__ + 1387
21 libSystem.B.dylib 0x93b13a19 _pthread_start + 345
22 libSystem.B.dylib 0x93b1389e thread_start + 34
)
terminate called after throwing an instance of 'NSException'
[INFO] Application has exited from Simulator
— asked July 28th 2010 by Kelly Redd
  • crash
  • iphone
  • textfield
0 Comments

3 Answers

  • Accepted Answer

    your code is wrong
    it is createTextField
    not createTextfield

    the F in field needs to be capitalized

    — answered July 28th 2010 by Laney Dale
    permalink
    1 Comment
    • Ah! You're so right! Much thanks Laney

      — commented July 28th 2010 by Kelly Redd
  • Hi Kelly.

    I read in the blog comment (#14) from Jeff Haynie:

    Introducing Titanium Mobile 1.4

    that you need to set width and height to auto.

    Give that a shot.

    • Simon.
    — answered July 28th 2010 by Simon Kok
    permalink
    0 Comments
  • Hi Kelly.

    I read in the blog comment (#14) from Jeff Haynie:

    Introducing Titanium Mobile 1.4

    that you need to set width and height to auto.

    Give that a shot.

    • Simon.
    — answered July 28th 2010 by Simon Kok
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.