我有这段代码,我想使用 Tcp 套接字将图像发送到服务器:
UIImage *image=[UIImage imageNamed:@"J-Eje_Ambiental.png"];
NSData *imgData = UIImageJPEGRepresentation(image, 1.0);
NSString *encodedString = [imgData base64Encoding];
NSLog(@"image code : %@",encodedString);
NSString *response = [NSString stringWithFormat:@"ing:%@",encodedString];
NSLog(@"image code : %@",response);
NSData *data = [[NSData alloc] initWithData:[response dataUsingEncoding:NSUTF8StringEncoding]];
[outputStream write:[data bytes] maxLength:[data length]];
当我在 xcode 中打印 bas64string 时它有数百行但在服务器上我只有 19 行我没有收到所有图像数据......
请帮忙 !!