简体   繁体   English

如何使用ARC使用NSData初始化字符串

[英]How to initialize a String with NSData with ARC

I'm trying to do this: 我正在尝试这样做:

NSString *responseDataString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];

but in ARC, I can't use [NSString alloc] . 但是在ARC中,我不能使用[NSString alloc] I do not want to disable ARC for this file, so is there a way to do the same thing in ARC with other methods? 我不想为此文件禁用ARC,是否可以通过其他方法在ARC中执行相同的操作?

alloc works just fine under ARC. alloc在ARC下工作正常。 The code you've written should be OK. 您编写的代码应该可以。 Why do you think it's not working? 您为什么认为它不起作用?

[ NSString alloc ]在ARC下完全有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM