从数组中删除所有项目并重新填充它

use*_*331 3 arrays objective-c

我有这个数组:

NSArray *currentPath;
Run Code Online (Sandbox Code Playgroud)

它在这里填充:

currentPath = [[[self.tableData objectAtIndex:indexPath.row] objectForKey:@"Name"] componentsSeparatedByString:@"FTP\\"];
Run Code Online (Sandbox Code Playgroud)

我需要再次重新填充这个数组

NSString *newPreviousPath = [previousPath stringByReplacingOccurrencesOfString:nextItemToRemoveString withString:@""];

    currentPath = [newPreviousPath];
Run Code Online (Sandbox Code Playgroud)

但我一直收到这个错误:

Expected identifier
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题并完成这项工作?

Adi*_*mro 5

与swift不同,在客观c中你应该这样做:

currentPath = @[newPreviousPath];
Run Code Online (Sandbox Code Playgroud)

看看@Objective C中的魔术符号,详细解答如下:Objective-C中是否有一些文字字典或数组语法?