iOS & Stackmob - [NSNull length]: unrecognized selector sent to instance -


in ios app i'm trying update user information in database (with stackmob), keep getting "unrecognized selector sent instance."

- (ibaction)save:(uibutton *)sender {  nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] initwithentityname:@"user"]; nspredicate *predicte = [nspredicate predicatewithformat:@"username == %@", self.username]; [fetchrequest setpredicate:predicte];  [self.managedobjectcontext executefetchrequest:fetchrequest onsuccess:^(nsarray *results) {      nsmanagedobject *todoobject = [results objectatindex:0];     [todoobject setvalue:@"example@gmail.com" forkey:@"email"];      [self.managedobjectcontext saveonsuccess:^{         nslog(@"you updated todo object!");     } onfailure:^(nserror *error) {         nslog(@"there error! %@", error);     }];  } onfailure:^(nserror *error) {      nslog(@"error fetching: %@", error);  }]; } 

here's full error i'm getting:

-[nsnull length]: unrecognized selector sent instance 0x1ec5678  2013-07-21 12:01:25.773 [29207:c07] *** terminating app due uncaught exception 'nsinvalidargumentexception',  reason: '-[nsnull length]: unrecognized selector sent instance 0x1ec5678' 

thanks in advance.

i think may because self.username empty. note if getting username data json , can't use if(username){...}

if(![username iskindofclass:[nsnull class]]) 

to avoid empty data because json interpreter generate nsnull object.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -