perform Parse.com user signup on the current thread (signUp:) and retrieving the NSError
我必须在当前线程上调用Parse的用户signUp方法,而不是在后台线程上调用,因为已经在后台线程上调用了它。
我注意到方法
这里是注册:文档
我尝试向我的用户对象添加一个名为NSError * latestError的额外属性,我希望调用所提到的方法并将NSError返回到该值中,以便我可以处理主线程上的错误:
1 2 3 4 5 6 | -(BOOL)registerUser{ PFUser *newUser = [PFUser user]; newUser.username = self.username; newUser.password = self.password; return [newUser signUp:self.lastError]; // error } |
但是我得到这个错误:
Implicit conversion of an Objective-C ponter to 'NSError
*__autoreleasing *' is disallowed with ARC
有什么想法如何使它与这种方法或替代方法一起使用以实现相同的结果?
您必须传递对
你的新代码应该像
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | -(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 the error or show alert return NO; } return YES; } |