ARC禁止自动释放?

wuf*_*foo 0 iphone nsstring ios

新的ios并尝试从函数返回NSString.据我了解,我需要[NSString... alloc] init]为了返回创建字符串.此外,因为我打电话alloc,我想我必须自己自动释放该对象,但是我收到消息"ARC禁止'autorelease'的显式消息发送"所以..当我完成分配的NSString时,我怎么告诉ios ?

- (NSString *) generateUID
{
    char foo[32];
    // create buffer of all capital psuedo-random letters
    for (int i = 0; i < sizeof(foo); i++)
       foo[i] = (random() % 25) + 65; // 0-25 + CAPITAL_A

    NSString *uid = [[NSString alloc] initWithBytes:foo length:sizeof(foo) encoding:NSASCIIStringEncoding];
    NSLog (@"uid: %@", uid);
    return (uid);
}
Run Code Online (Sandbox Code Playgroud)

dan*_*n78 8

ARC =自动引用计数=编译器基础上增加代码的分析中所需的发布和autorelases.你当然不会看到这一点,因为它发生在幕后.正如在他的评论中提到的sosbom,你真的应该阅读适用的苹果网站上的文档.