简体   繁体   English

重写文字NSArray以在OS X 10.6的gcc上进行编译

[英]Rewrite literal NSArray to compile on gcc for OS X 10.6

I got a suggestion here on SO to write this line: 我在这里有一条关于写此行的建议:

NSArray *files = @[url];

However my Xcode/gcc is outdated as I'm still using OSX 10.6. 但是我的Xcode / gcc已过时,因为我仍在使用OSX 10.6。

How do I rewrite this line so that it will compile? 我如何重写此行以便可以编译?

If you need to use the old style Objective-C syntax you would write: 如果您需要使用旧式的Objective-C语法,则可以编写:

NSArray *files = [NSArray arrayWithObjects:url, nil];

or just: 要不就:

NSArray *files = [NSArray arrayWithObject:url];

Look at the documentation for NSArray . 查看NSArray的文档。

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

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