Skip to content

Instantly share code, notes, and snippets.

@bouchtaoui-dev
Created December 2, 2017 18:45
Show Gist options
  • Select an option

  • Save bouchtaoui-dev/b62aa38a19b03efdabda2133bb58a178 to your computer and use it in GitHub Desktop.

Select an option

Save bouchtaoui-dev/b62aa38a19b03efdabda2133bb58a178 to your computer and use it in GitHub Desktop.
-(NSString *) someMethod:(int) id withError:(NSError **)errorPtr{
if(id == 1)
{
return @"Execution of some code...";
}
else
{
NSString *domain = @"com.MyCompany.MyApplication.ErrorDomain";
NSString *desc =@"Unable to complete the process";
NSDictionary *userInfo = [[NSDictionary alloc]
initWithObjectsAndKeys:desc,
@"NSLocalizedDescriptionKey",NULL];
*errorPtr = [NSError errorWithDomain:domain code:-101
userInfo:userInfo];
return @"";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment