AFNetworking
을 사용하여 이미지를 게시하는 방법 image.but 이미지를 게시하려면 아래 코드를 사용하여 이미지를 게시하고 있습니다. 서버에 이미지가 업로드되지 않습니다. 이미지를 게시 한 후 결과 "http://thisisswitch.com:8084/SmartSwitchService/UserImages/69684177-4601-4665-8890-5424e3fbff73.png"에이 링크가 표시됩니다.AFNetworking을 사용하여 이미지를 게시 하시겠습니까?
누구든지 코드의 문제점을 알 수 있습니까? Github read me에서
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:BaseUrl]];
NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:posturl parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFormData:imgData name:@"image"];
}];
[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSDictionary *dict = (NSDictionary *)JSON;
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
}];
[operation start];
PHP에서 문제가 발생하지 않았습니까? 파일이 서버에 생성되지 않으면 링크를 반환해서는 안됩니다 ... 어떤 백엔드를 사용하고 있습니까? 너 자신이 쓴거야? –
이 줄에 의심의 여지가 있습니다 [formData appendPartWithFormData : imgData 이름 : @ "image"]; 이 줄의 이름은 무엇입니까 – user2064546
백엔드의 .net – user2064546