ios - TextField returning nil with valid value entered. Parse.com Issue -


i have textfield passes value parse object. working great, added tab bar controller tableviewcontroller subclass of pfquerytableviewcontroller. neither self.message.text; or message.text(synthesized) pass correct value, instead passes nil , app crashes.

here sample of code trying run:

 -(bool)textfieldshouldreturn:(uitextfield *)textfield {     nsstring *echo = message.text;      pfuser *currentuser = [pfuser currentuser];     if (currentuser) {         pfobject *echoobject = [pfobject objectwithclassname:@"echo"];         echoobject[@"body"] = echo;         echoobject[@"title"] = @"echo";         echoobject[@"user"] = currentuser;         [echoobject saveinbackground];          nslog(echo);         nslog(@"test");     } else {         // show signup or login screen     }      [self loadobjects];     return yes; } 

adding tabbarcontroller thing can think of effect view controller in way breaks code. update question if think of else have broken code.

i have verified object causes exception echoobject[@"body"] = echo; due value being nil. in nslog, message not printed console.

update

i managed code work pulling textfield value directly method, so:

 -(bool)textfieldshouldreturn:(uitextfield *)textfield {     nsstring *echo = textfield.text;       pfuser *currentuser = [pfuser currentuser];     if (currentuser) {         pfobject *echoobject = [pfobject objectwithclassname:@"echo"];         echoobject[@"body"] = echo;         echoobject[@"title"] = @"echo";         echoobject[@"user"] = currentuser;         [echoobject saveinbackground];          nslog(echo);         nslog(@"test");     } else {         // show signup or login screen     }       [self loadobjects];      return yes; } 

this how code should have been in first place, clarification on why self pointer , synthesized pointers not working.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -