我有这个数组:
$event_list = $service->events->listEvents('my_calendar_id', ['syncToken' => 'my_old_calendar_sync_token']);
并在此填充:
NSArray *currentPath;
我需要再次重新填充这个数组
currentPath = [[[self.tableData objectAtIndex:indexPath.row] objectForKey:@"Name"] componentsSeparatedByString:@"FTP\\"];
但我一直收到这个错误:
NSString *newPreviousPath = [previousPath stringByReplacingOccurrencesOfString:nextItemToRemoveString withString:@""];
currentPath = [newPreviousPath];
如何解决此问题并完成此任务?
答案 0 :(得分:5)
与swift不同,在目标c中你应该这样做:
id = User.find(someid)
查看目标C中的魔术currentPath = @[newPreviousPath];
符号,详细解答如下:Is there some literal dictionary or array syntax in Objective-C?
答案 1 :(得分:0)
currentPath = [newPreviousPath]; 就像在这里使用Literals语法一样,它不是分配数组的正确方法。你需要做以下事情 currentPath = @ [newPreviousPath];