I convert string into array by componentsSeparatedByString. It return array perfect. but when string is empty return 1 object.
why this happen ?
NSMutableArray *imagesList=[[[productDetail objectForKey:@"productImage"] componentsSeparatedByString:@","]mutableCopy];
It is because, you are passing empty string("") and componentsSeparatedByString
is trying to separate your string by comma(,) but their is no comma(,) in your string so it is returning 1 array item(that is "").
NSMutableArray *imagesList = [[NSMutableArray alloc]init];
if(![productDetail isEqualToString:@""]) {
imagesList=[[[productDetail objectForKey:@"productImage"] componentsSeparatedByString:@","]mutableCopy];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With