웹 API를 호출하여 대상 C에서 응답하지 않습니다.웹 서비스 앱에서 작동하지 않지만 우편 배달부에서 작동 중
POST 메서드를 사용하여 API를 호출하고 있습니다.
이 Api에는 이미지 및 기타 매개 변수가 있습니다.
같은 매개 변수 나는 그것이 작동하지 않는 응용 프로그램에서 동일한 같이 보내려고하고 때 잘 작동하지만 것 우체부에 보낸다.
도와주세요. 이것은 게시 용 코드입니다.
NSString *stringurl=[NSString stringWithFormat:@"%@",[dict valueForKey:@"ApiSiteUrl"]];
NSString * encodedUrl = [stringurl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
NSURL *url = [NSURL URLWithString:encodedUrl];
requestAddPost = [ASIFormDataRequest requestWithURL:url];
[requestAddPost setRequestMethod:@"POST"];
[requestAddPost setPostValue:@"CreatePost" forKey:@"AppRequest"];
[requestAddPost setPostValue:[dict valueForKey:@"PassCode"] forKey:@"PassCode"];
[requestAddPost setPostValue:[dict valueForKey:@"ApiSiteUrl"] forKey:@"ApiSiteUrl"];
[requestAddPost setPostValue:txtPostTitle.text forKey:@"postTitle"];
[requestAddPost setPostValue:txtPostContent.text forKey:@"postContent"];
[requestAddPost setPostValue:currentSelectedId forKey:@"postCategory"];
NSData *dataOfContent = UIImageJPEGRepresentation([arrOfImage objectAtIndex:0],0.5);
int r = rand() % 74;
NSDate *currentDate = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd.MM.YY HH:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:currentDate];
NSString *imageName=[NSString stringWithFormat:@"%@PostImage%d.png",dateString,r];
[requestAddPost addData:dataOfContent withFileName:imageName andContentType:@"image/png" forKey:@"postImage"];
[requestAddPost setTimeOutSeconds:60];
[requestAddPost setDelegate:self];
[requestAddPost startAsynchronous];
우편 번호를 example.com를 교체 당신의 Info.plist 파일에 라인 아래에있을 것입니다 ... –
는 AFNetworking 또는 Almofire를 사용하는 ? 또한 여기 우편 배달부의 답변을 게시 할 수 있습니까? –
안녕하세요. 저는 Responce를 사용하지 않습니다. –