Tag: 传送

等待多部分图像发送完成

我正在iOS7中的一个应用程序,这是一种社交networking应用程序与图像的post和后端,保存所有客户端发送的数据。 iOS客户端通过json发送post信息,发送信息后,开始使用AFNetworking通过多部分forms发送图片。 我需要在图像发送时得到通知,以便我可以刷新应用程序的主视图,包括最近发布的新post。 在实践中,如果我要求后端的最后一个post,多部分还没有完成,图像的发送被中断,并不能发送图像。 后端是在WCF开发的,并且是一个RESTful JSON Web服务。 以下是将post发送到后端的方法: +(void)addPostToServerAddtext:(NSString *)text addimage:(UIImage *)image addbeach:(NSString *)beach location:(NSString*)location; { NSLog(@"entro a addPost"); NSString *urlBackend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"URLBackend"]; NSData* dataImage = UIImageJPEGRepresentation(image, 1.0); NSString* ImageName = [NSString stringWithFormat:@"%@_%@.jpg",idUser ,dateToServer]; NSString *jsonRequest = [NSString stringWithFormat:@"{\"Date\":\"%@\"…."]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@newPost",urlBackend]]; NSMutableURLRequest *request = [ [NSMutableURLRequest alloc] initWithURL:url]; NSData […]