from:【object-c错误处理】http://www.androiddev.net/objective-c%E5%AD%A6%E4%B9%A0%E4%B9%8B%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/
NSString *domain = @”com.MyCompany.MyApplication.ErrorDomain”;
NSString *desc = NSLocalizedString(@”Unable to…”, @””);
NSDictionary *userInfo = @{ NSLocalizedDescriptionKey : desc };
NSError *error = [NSError errorWithDomain:domain
code:-101
userInfo:userInfo];
使用的时候:
if(!error){//如果没有错误 [self.dataArr addObjectsFromArray:dataarray]; [self.tableView reloadData]; [self.tableView.mj_footer endRefreshing]; }else if([error.localizedDescription isEqualToString:@"No data returned"]){//如果有错误 [self.tableView.mj_footer endRefreshingWithNoMoreData]; }