Ich versuche Web Api zu rufen, das mir keine Antwort in Ziel c sendet.Web Service funktioniert nicht in der App, aber im Postboten funktioniert
Ich rufe API mit POST-Methode.
Diese Api hat Bild und einige andere Parameter.
Der selbe Parameter, den ich im Postboten sende, funktioniert gut, aber wenn ich versuche, dasselbe in der App zu senden, funktioniert es nicht.
Bitte helfen Sie mir. Dies ist mein Code für den Post.
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];
Postleitzahl, so dass wir sagen, was schief läuft ... –
sind Sie mit AFNetworking oder Almofire ? Kannst du deine Postboteantwort hier auch posten? –
Hallo, ich bekomme Antwort nil. –