Skip to content

Instantly share code, notes, and snippets.

@iteufel
Created August 17, 2014 16:54
Show Gist options
  • Save iteufel/28757cb1d7615d0981ca to your computer and use it in GitHub Desktop.
Save iteufel/28757cb1d7615d0981ca to your computer and use it in GitHub Desktop.
- (NSDictionary*)argsToDictionary{
//Get the arguments as an Array
NSMutableArray *arguments = [[NSMutableArray alloc]initWithArray:[[NSProcessInfo processInfo] arguments]];
//remove the path
[arguments removeObjectAtIndex:0];
//create the temp mutabledict
NSMutableDictionary *argsdict = [NSMutableDictionary dictionary];
for (int i=0; i<arguments.count; i++) {
if (arguments.count > i+1){
argsdict[arguments[i]] = arguments[i+1];
i++;
}
}
return [NSDictionary dictionaryWithDictionary:argsdict];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment