ARWebServerActivity 1.0.2

ARWebServerActivity 1.0.2

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2016

Maintained by alexruperez.



ARWebServerActivity is a UIActivity subclass that provides an "Share via web server" action to a UIActivityViewController to share files via swisspol/GCDWebServer with Twitter Bootstrap UI.

You can share:

  • NSString as TXT File.
  • UIImage as PNG File.
  • NSURL to a local/remote file.
  • NSData as DATA File.
  • NSDictionary as JSON File.
  • NSArray as JSON File.

ARWebServerActivity screenshot

Clone the example proyect

To pull the swisspol/GCDWebServer submodule run:

git clone --recursive [email protected]:alexruperez/ARWebServerActivity.git


  • As UIActivity is iOS >= 6 only, so is the subclass.
  • This project uses ARC. If you want to use it in a non ARC project, you must add the -fobjc-arc compiler flag to ARWebServerActivity.m and ARWebServerActivityViewController.m in Target Settings > Build Phases > Compile Sources.


Add the ARWebServerActivity subfolder to your project. There are no required libraries other than swisspol/GCDWebServer and its requirements.


(See example Xcode project)

Simply alloc/init an instance of ARWebServerActivity and pass that object into the applicationActivities array when creating a UIActivityViewController.

ARWebServerActivity *webServerActivity = [[ARWebServerActivity alloc] init];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"Hello World!", [UIImage imageNamed:@"Example"], [NSURL fileURLWithPath:@"file/path"], [NSURL URLWithString:@"file/url"], [@"data" dataUsingEncoding:NSUTF8StringEncoding], @{@"key": @[@"value1", @"value2"]}, @[@"value1", @"value2"]] applicationActivities:@[webServerActivity]];
[self presentViewController:activityViewController animated:YES completion:nil];

Note that you can include the activity in any UIActivityViewController and it will only be shown to the user if there is a valid object in the activity items.


To customize this control you can use:

- (instancetype)initWithPort:(NSNumber *)port bonjourName:(NSString *)bonjourName path:(NSString *)path activityViewController:(UIViewController *)activityViewController;
  • port: swisspol/GCDWebServer port.
  • bonjourName: If you want your server be visible at Bonjour.
  • path: If you want to change the local files path shared by your server. Note that will be removed after sharing.
  • activityViewController: If you want to change the default control UI, you can subclass ARWebServerActivityViewController and not call [super viewWillAppear:animated];, make your own UIViewController or improve my ARWebServerActivityViewController and make a pull request.

TO-DO (Help needed!)

  • Add (programmatically) Auto Layout constraints to ARWebServerActivityViewController and example Xcode project for screen rotation.
  • Improve ARWebServerActivityViewController UI.