Xcode 警告:格式不是字符串文字,也没有格式参数。有什么想法吗?

Xcode 警告:格式不是字符串文字,也没有格式参数。有什么想法吗?,xcode,xcode4,nsstring,Xcode,Xcode4,Nsstring,stringWithFormat:方法采用带有n参数的字符串格式。根据您的需要,只需使用: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSArray *listData =[self.tableContents objectForKey: [self.sortedKeys objectAtIndex:[index

stringWithFormat:
方法采用带有
n
参数的字符串格式。根据您的需要,只需使用:

- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *listData =[self.tableContents objectForKey:
                    [self.sortedKeys objectAtIndex:[indexPath section]]];
NSUInteger row = [indexPath row];
NSString *rowValue = [listData objectAtIndex:row];

NSString *message = [[NSString alloc] initWithFormat:rowValue];

UIAlertView *alert = [[UIAlertView alloc]
                      initWithTitle:@"You Better Be There Or Be Watching It!"
                      message:message delegate:nil
                      cancelButtonTitle:@"Go Knights!"
                      otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}


Line of code that throws error: 
NSString *message = [[NSString alloc] initWithFormat:rowValue];
----------
 Warning Message: format not a string literal and no format arguments
根据您的代码示例,您不需要为string对象分配内存或提供某种格式

NSString *message = rowValue;