2013-02-08 65 views
0

我在此代碼的最後一行收到錯誤消息Incompatible integer to pointer conversion sending 'unichar' (aka 'unsigned short') to parameter of type 'NSString *'characterAtIndex轉換爲NSString

NSMutableString *sp = [[NSMutableString alloc] initWithString:@"    "]; 
NSArray *[email protected][@[sp, sp, sp, sp], @[sp, sp, sp, sp]]; 
NSString* suits = @"NESW"; 
[deals[0][3] replaceCharactersInRange:NSMakeRange(1, 1) withString:[suits characterAtIndex:2]]; 

回答

2

由於錯誤說,characterAtIndex:返回一個單字符,而replaceCharactersInRange:withString:需要一個NSString。如果你想要一個帶索引2字符的NSString,試試substringWithRange:NSMakeRange(2,1)