이 문제에 대해 많은 솔루션을 사용할 수 있지만 때때로 한 번 실행되는 한 줄에 붙어 있습니다. 가끔씩 충돌이 발생합니다. 왜 이런 일이 벌어지는 지 잘 모릅니다. ....- [__ NSCFDictionary rangeOfString :] : 인식 할 수없는 선택자를 인스턴스로 보냄
여기 -[__NSCFDictionary rangeOfString:]: unrecognized selector sent to instance
여기를 누르면 버튼에 호출되는 방법 내 코드 인 오류가 메신저하는 게시 메일 내 코드입니다.
NSString* ingredientLine = [arrayOfIngredientList objectAtIndex:i];
NSArray* split ;
NSRange range = [ingredientLine rangeOfString:@"~"];
if (range.length > 0)
{
split = [ingredientLine componentsSeparatedByString:@"~"];
if([split count] > 1)
{
float amount = [[split objectAtIndex:0] floatValue];
float actualAmount = amount*((float)recipeServings/(float)4);
//parse the float if its 1.00 it becomes only 1
NSString* amnt = [NSString stringWithFormat:@"%.1f", actualAmount];
NSArray* temp = [amnt componentsSeparatedByString:@"."];
if([[temp objectAtIndex:1] isEqualToString: @"0"])
amnt = [temp objectAtIndex:0];
if(actualAmount == 0.0)
amnt = @"";
[amnt stringByReplacingOccurrencesOfString:@".0" withString:@""];
NSLog(@"Amount is : %@",[split objectAtIndex:1]);
strAmount = [@"" stringByAppendingFormat:@"%@ %@",amnt,[split objectAtIndex:1]];
NSLog(@"Ingredient is : %@", strAmount);
strIngedient = [split objectAtIndex:2];
}
else //ingredients header
{
//[[cell viewWithTag:10] setHidden:YES];
strIngedient = [split objectAtIndex:0];
}
}
else
{
}
strIngredientsInfo = [strIngredientsInfo stringByAppendingFormat:@"%@ - %@ </br>",strAmount,strIngedient];
이 앱은
NSArray* split ;
NSRange range = [ingredientLine rangeOfString:@"~"];
if (range.length > 0)
{
split = [ingredientLine componentsSeparatedByString:@"~"];
}
이 제발 도와주세요 인해 충돌합니다.
왜 충돌하는지 제안하시오 ????
[arrayOfIngredientList objectAtIndex:i]
대신 NSString
당신이 기대하는 NSDictionary
의 인스턴스를 반환 그것은이 작업을 수행 어딘가에 사전에 그에서 NSDictionary
저장되어 있기 때문에 : 코드 때때로이 작품이 때문에 :(
'ingredientsLine '은 어디에서 왔습니까? 때로 NSString이 아닌 NSDictionary 인 것처럼 보입니다. – mattjgalloway
Inderdientline을 추가했습니다. 인덱스 배열을 얻는 중 .. – NSException
좋아요, 그럼'arrayOfIngredientList'는 어디서 오는 거죠? 거기에있는 유일한 객체는'NSString'입니까? (Gah 누군가가'arrayOfIngredientList'를 보여주기 위해 추가 한 비트를 제거했습니다!) – mattjgalloway