I am currently cheating in a Mac app and setting the HttpProxy like below, but I really want to change this to turn the Proxy on and of programmatically. Does anyone know how I can do this?
if (host != nil) {
NSLog(@"Setting Host and Port. %@:%d", host, port);
[task setArguments:[NSArray arrayWithObjects😡"-setwebproxy", @"Airport", host, [NSString stringWithFormat😡"%d", port], nil]];
} else {
[task setArguments:[NSArray arrayWithObjects😡"-setwebproxystate", @"Airport", @"on", nil]];
}
[delegate notification😡"Proxy Enabled" withKey😡"Proxy"];
if (host != nil) {
NSLog(@"Setting Host and Port. %@:%d", host, port);
[task setArguments:[NSArray arrayWithObjects😡"-setwebproxy", @"Airport", host, [NSString stringWithFormat😡"%d", port], nil]];
} else {
[task setArguments:[NSArray arrayWithObjects😡"-setwebproxystate", @"Airport", @"on", nil]];
}
[delegate notification😡"Proxy Enabled" withKey😡"Proxy"];