Difference between NSString literals

后端 未结 5 772
难免孤独
难免孤独 2020-11-27 06:46

What is the difference between these two lines?

NSString * string = @\"My String\";
NSString * string = [[[NSString alloc] initWithString:@\"MyString\"] auto         


        
5条回答
  •  孤城傲影
    2020-11-27 07:22

    There is no difference between them. A string initiated how you showed in the first example is an autoreleased string.

提交回复
热议问题