Ios 在数组中转换NSData响应

Ios 在数组中转换NSData响应,ios,iphone,nsarray,nsdata,Ios,Iphone,Nsarray,Nsdata,我调用了一个WS,收到了响应NSData。 我打印reuqest: data = <66096669 6c65312e 7478740a 66096669 6c65322e 7478740a 66096162 632e7478 740a4609 666f6c64 6572310a 4609666f 6c646572 320a6609 66696c65 332e7478 740a6609 66696c65 342e7478 740a4609 666f6c64 657233>

我调用了一个WS,收到了响应NSData。 我打印reuqest:

   data = <66096669 6c65312e 7478740a 66096669 6c65322e 7478740a 66096162 632e7478 740a4609 666f6c64 6572310a 4609666f 6c646572 320a6609 66696c65 332e7478 740a6609 66696c65 342e7478 740a4609 666f6c64 657233> 
当我打印新闻时:

newStr =
f   file1.txt
f   file2.txt
f   abc.txt
F   folder1
F   folder2
f   file3.txt
f   file4.txt
F   folder3
我需要用NSString中的内容填充UITableView,并且需要将字符串内容添加到NSSArray中。

您可以像这样直接将NSData响应转换为数组

    NSError* error;
    if (responseData != nil){
    NSMutableArray* json = [NSJSONSerialization JSONObjectWithData:responseData //1
                                                       options:0
                                                         error:&error];

    NSLog(@"%@",json);

  }

如果您查看NSString的文档,您的问题将得到回答。感谢提供信息!我使用self.dataSourceArray=[newStr componentsSeparatedByString:@\n]解决了这个问题;
    NSError* error;
    if (responseData != nil){
    NSMutableArray* json = [NSJSONSerialization JSONObjectWithData:responseData //1
                                                       options:0
                                                         error:&error];

    NSLog(@"%@",json);

  }