How to convert NSMutableData to NSString on iPhone?

后端 未结 1 906
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 14:10

I received an NSMutableData from a server and now I want to convert it to an NSString. Any ideas about how to do this?

1条回答
  •  [愿得一人]
    2021-01-31 14:59

    You can use the initWithData: initializer:

    [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
    

    Change the encoding to that of the source data.

    0 讨论(0)
提交回复
热议问题