-2

我想使用一些现有的网络服务发送我的字节数据。现在我不想更多地探索 Web 服务,但我只想将我的以下字节数据用于一些已经存在的 Web 服务。例如,以下是我的字节数据。

Byte *byteData = (Byte*)malloc(len);
memcpy(byteData, (Byte*)myData, len);

我怎样才能做到这一点 !?我只想使用现有的 Web 服务,非常感谢您的帮助。

已编辑

我也有 json 格式的 NSData。如下代码

const unsigned char *bytes = [myData bytes]; // no need to copy the data

NSUInteger length = [myData length];

NSMutableArray *byteArray = [NSMutableArray array];

for (NSUInteger i = 0; i < length; i++)
{

    [byteArray addObject:[NSNumber numberWithUnsignedChar:bytes[i]]];
}

NSDictionary *dictJson = [NSDictionary dictionaryWithObjectsAndKeys:
                          byteArray, @"vedio",
                          nil];

NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictJson options:0 error:NULL];
4

1 回答 1

0

我只是像这样发送我的 NSdata 或说 ByteData:

NSMutableDictionary *dictParam = [NSMutableDictionary dictionary];

[dictParam setValue:mydata forKey:@"pattern"];

NSString *Web_str_pattern = @"my webservice link";

JSONParser *parser = [[JSONParser alloc]initWith_withURL:Web_str_pattern withParam:dictParam withData:nil withType:kPostURL withSelector:@selector(getData:) withObject:self];

在这里,我将 JSONParser 用于 Web 服务。

于 2013-11-07T11:25:21.913 回答