简体   繁体   English

NSMutableArray alloc init 在 iOS9 中被弃用了?

[英]NSMutableArray alloc init deprecated in iOS9?

I am using Deploymate tool to check deprecation and iOS version compatibility, some of you might know.我正在使用 Deploymate 工具来检查弃用和 iOS 版本兼容性,你们中的一些人可能知道。 It is telling me它在告诉我

init
Deprecated in iOS 9.0

for code like对于像这样的代码

[[NSMutableArray alloc] init];

Could not find anything about deprecation.找不到任何关于弃用的信息。 Can someone enligten me.有人可以启发我。 Is this a "bug" in Deploymate or is it really deprecated?这是 Deploymate 中的“错误”还是真的已弃用? Do I need to change something to我需要改变一些东西吗

[[NSMutableArray alloc] init];

I don't have Deploymate but it seems like it seems like it may prefer you to use [NSMutableArray new];我没有 Deploymate,但它似乎更喜欢你使用[NSMutableArray new]; instead of [[NSMutableArray alloc] init];而不是[[NSMutableArray alloc] init]; . .

However you can't use the new method if you pass in init options such as [[NSMutableArray alloc] initWithArray:@[@"Foo", @"Bar"]];但是,如果传入诸如[[NSMutableArray alloc] initWithArray:@[@"Foo", @"Bar"]];初始化选项,则无法使用new方法[[NSMutableArray alloc] initWithArray:@[@"Foo", @"Bar"]]; . .

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

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