Quando si converte un progetto in ARC, cosa significa "switch case is in scope scope"? Sto convertendo un progetto per usare ARC, usando Xcode 4 Modifica -> Refactor -> Converti in Objective-C ARC ... Uno degli errori che ottengo è "la custodia dello switch è in ambito protetto" su "alcuni" degli switch in una custodia.
Modifica, ecco il codice:
l'ERRORE è contrassegnato sul caso "predefinito":
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"";
UITableViewCell *cell ;
switch (tableView.tag) {
case 1:
CellIdentifier = @"CellAuthor";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [[prefQueries objectAtIndex:[indexPath row]] valueForKey:@"queryString"];
break;
case 2:
CellIdentifier = @"CellJournal";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [[prefJournals objectAtIndex:[indexPath row]] valueForKey:@"name"];
NSData * icon = [[prefJournals objectAtIndex:[indexPath row]] valueForKey:@"icon"];
if (!icon) {
icon = UIImagePNGRepresentation([UIImage imageNamed:@"blank72"]);
}
cell.imageView.image = [UIImage imageWithData:icon];
break;
default:
CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
break;
}
return cell;
}