Upload videos with objective c

后端 未结 2 2013
太阳男子
太阳男子 2021-01-03 16:27

I am to build a really complicated (at least to me) app now. The basic app is as follows:

A tab bar app with two tabs, one for local videos and the other for streami

2条回答
  •  -上瘾入骨i
    2021-01-03 17:19

    Using AFNetworking:

    NSURL *url = [NSURL URLWithString:@"http://api-base-url.com"];
    AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
    NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"avatar.jpg"], 0.5);
    NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:@"/upload" parameters:nil constructingBodyWithBlock: ^(id formData) {
        [formData appendPartWithFileData:imageData name:@"avatar" fileName:@"avatar.jpg" mimeType:@"image/jpeg"];
    }];
    

提交回复
热议问题