mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-04-24 00:00:04 +08:00
Update README.md
This commit is contained in:
@@ -77,8 +77,10 @@ int main(int argc, const char* argv[]) {
|
|||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// Use convenience method that runs server on port 8080 until SIGINT received (i.e. Ctrl-C in Terminal)
|
// Use convenience method that runs server on port 8080
|
||||||
|
// until SIGINT (Ctrl-C in Terminal) or SIGTERM is received
|
||||||
[webServer runWithPort:8080 bonjourName:nil];
|
[webServer runWithPort:8080 bonjourName:nil];
|
||||||
|
NSLog(@"Visit %@ in your web browser", webServer.serverURL);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -90,7 +92,12 @@ int main(int argc, const char* argv[]) {
|
|||||||
#import "GCDWebServer.h"
|
#import "GCDWebServer.h"
|
||||||
#import "GCDWebServerDataResponse.h"
|
#import "GCDWebServerDataResponse.h"
|
||||||
|
|
||||||
static GCDWebServer* _webServer = nil; // This should really be an ivar of your application's delegate class
|
@interface AppDelegate : NSObject <UIApplicationDelegate> {
|
||||||
|
GCDWebServer* _webServer;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AppDelegate
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
||||||
|
|
||||||
@@ -108,9 +115,12 @@ static GCDWebServer* _webServer = nil; // This should really be an ivar of your
|
|||||||
|
|
||||||
// Start server on port 8080
|
// Start server on port 8080
|
||||||
[_webServer startWithPort:8080 bonjourName:nil];
|
[_webServer startWithPort:8080 bonjourName:nil];
|
||||||
|
NSLog(@"Visit %@ in your web browser", _webServer.serverURL);
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
```
|
```
|
||||||
|
|
||||||
Web Based Uploads in iOS Apps
|
Web Based Uploads in iOS Apps
|
||||||
@@ -123,7 +133,12 @@ Simply instantiate and run a ```GCDWebUploader``` instance then visit ```http://
|
|||||||
```objectivec
|
```objectivec
|
||||||
#import "GCDWebUploader.h"
|
#import "GCDWebUploader.h"
|
||||||
|
|
||||||
static GCDWebUploader* _webUploader = nil; // This should really be an ivar of your application's delegate class
|
@interface AppDelegate : NSObject <UIApplicationDelegate> {
|
||||||
|
GCDWebUploader* _webUploader;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AppDelegate
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
||||||
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
||||||
@@ -132,6 +147,8 @@ static GCDWebUploader* _webUploader = nil; // This should really be an ivar of
|
|||||||
NSLog(@"Visit %@ in your web browser", _webUploader.serverURL);
|
NSLog(@"Visit %@ in your web browser", _webUploader.serverURL);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
```
|
```
|
||||||
|
|
||||||
WebDAV Server in iOS Apps
|
WebDAV Server in iOS Apps
|
||||||
@@ -146,7 +163,12 @@ Simply instantiate and run a ```GCDWebDAVServer``` instance then connect to ```h
|
|||||||
```objectivec
|
```objectivec
|
||||||
#import "GCDWebDAVServer.h"
|
#import "GCDWebDAVServer.h"
|
||||||
|
|
||||||
static GCDWebDAVServer* _davServer = nil; // This should really be an ivar of your application's delegate class
|
@interface AppDelegate : NSObject <UIApplicationDelegate> {
|
||||||
|
GCDWebDAVServer* _davServer;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AppDelegate
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
||||||
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
||||||
@@ -155,6 +177,8 @@ static GCDWebDAVServer* _davServer = nil; // This should really be an ivar of y
|
|||||||
NSLog(@"Visit %@ in your WebDAV client", _davServer.serverURL);
|
NSLog(@"Visit %@ in your WebDAV client", _davServer.serverURL);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
```
|
```
|
||||||
|
|
||||||
Serving a Static Website
|
Serving a Static Website
|
||||||
|
|||||||
Reference in New Issue
Block a user