ios - perform Parse.com user signup on the current thread (signUp:) and retrieving the NSError -
i have call parse's user signup method on current thread, not background thread it's being called on background thread. -(bool)signup
method isn't enough bool response if registration successful or not, have handle potential errors.
i've noticed method -(bool)signup:(nserror **)error
current ios programming skills not there yet when comes understanding how use :)
i've tried adding property user object called nserror *latesterror , hoping call mentioned method , put nserror returned value can handle errors on main thread:
-(bool)registeruser{ pfuser *newuser = [pfuser user]; newuser.username = self.username; newuser.password = self.password; return [newuser signup:self.lasterror]; // error }
but error:
implicit conversion of objective-c ponter 'nserror *__autoreleasing *' disallowed arc
any ideas how make work method or alternative ways achieve same result?
you have pass reference nserror
object.. parse process , if error there update error object appropriate error.
you new code should like
-(bool)registeruser{ nserror *error = nil; pfuser *newuser = [pfuser user]; newuser.username = self.username; newuser.password = self.password; [newuser signup:&error]; // error if( error != nil) { //log error or show alert return no; } return yes; }
Comments
Post a Comment