Привет Я пытаюсь скомпилировать следующий код, но получаю ошибку Use of undeclered identifier AFHTTPClient
:Использование необъявленный идентификатор AFHTTPClient
NSData* fileNameData = [fileName dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *sendDictionary =
[NSDictionary dictionaryWithObject:fileNameData forKey:@"fileName"];
AFHTTPClient *httpClient =
[[AFHTTPClient alloc] initWithBaseURL:@"http://www.olcayertas.com"];
NSMutableURLRequest *afRequest =
[httpClient multipartFormRequestWithMethod:@"POST"
path:@"/photos"
parameters:sendDictionary
constructingBodyWithBlock:^(id <AFMultipartFormData>formData) {
[formData appendPartWithFileData:photoImageData
name:self.fileName.text
fileName:filePath
mimeType:@"image/jpeg"];
}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:afRequest];
[operation setUploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];
[operation setCompletionBlock:^{
//NSLog(@"%@", operation.responseString); //Gives a very scary warning
}];
[operation start];
Я использованияКонтактная CocoaPods и вот мой стручок файл:
platform :ios, '7'
pod 'AFNetworking', '~> 2.0'
pod 'AFNetworking/NSURLSession', '~> 2.0'
Мои '# import's? – Wain
AfNetworking 2.0 remove AFHTTPClient см. Http://stackoverflow.com/questions/19503750/afhttpclient-m-no-longer-in-afnetworking – bugman79