I have a method that puts the words from a string into a NSMutable array, I'm using a NSscanner, but it keeps throwing me NULL, any ideas??
here is my code:
"arrayConPalabras" is previously defined....
here is my code:
Code:
-(void)rellenarArrayConPalabras: (NSString *)texto
{
NSString * textoTemporal =[NSString string];
textoTemporal=texto;
NSString * palabraTemporal=[NSString string];
NSScanner * nuevoscaner=[NSScanner scannerWithString:textoTemporal];
NSCharacterSet *espacios=[NSCharacterSet whitespaceCharacterSet];
while( ![nuevoscaner isAtEnd])
{
if ( [nuevoscaner scanUpToCharactersFromSet:espacios intoString:&palabraTemporal] )
{
[arrayConPalabras addObject:palabraTemporal];
}
NSLog(@"%@", arrayConPalabras);
}
}
"arrayConPalabras" is previously defined....