modify by OYXJ on 2016.08
AFHTTPRequestOperation —> NSURLSessionDataTask
XML formart via Ono
the commit of code has been verified in a project of my company. SO IT WORKS !
P.S. ---> merge the following
1、Fixed crash related to sending 'URL' selector to '_NSInlineData' inst… thanks to @danielr danielr@1ba182b
2、WebDav Response Namespace not always 'D' thanks to @BitSuites BitSuites@c25abdb
AFWebDAVManager
is an AFHTTPRequestOperationManager
subclass for interacting with WebDAV servers.
Caution: This code is still in its early stages of development, so exercise caution when incorporating this into production code.
AFWebDAVManager *webDAVManager = [[AFWebDAVManager alloc] initWithBaseURL:[NSURL URLWithString:@"http://example.com"]];
webDAVManager.credential = [NSURLCredential credentialWithUser:@"username"
password:@"Pa55word"
persistence:NSURLCredentialPersistenceForSession];
[webDAVManager createFileAtURLString:@"/path/to/file.txt"
withIntermediateDirectories:YES
contents:[@"Hello, World" dataUsingEncoding:NSUTF8StringEncoding]
completionHandler:^(NSURL *fileURL, NSError *error)
{
if (error) {
NSLog(@"[Error] %@", error);
} else {
NSLog(@"File created: %@", fileURL);
}
}];
[webDAVManager contentsOfDirectoryAtURLString:@"/path"
recursive:NO
completionHandler:^(NSArray *items, NSError *error)
{
if (error) {
NSLog(@"[Error] %@", error);
} else {
NSLog(@"Items: %@", items);
}
}];
Mattt Thompson
AFWebDAVManager is available under the MIT license. See the LICENSE file for more info.