简体   繁体   中英

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.

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:

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

or just:

NSArray *files = [NSArray arrayWithObject:url];

Look at the documentation for NSArray .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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