I need to check if my value contains "false" or a string.
JSON:
{"success":true,"name":[{"image":false},{"image":"https:\/\/www.url.com\/image.png"}]}
My Code:
NSData *contentData = [[NSData alloc] initWithContentsOfURL:url];
NSDictionary *content = [NSJSONSerialization JSONObjectWithData:contentData options:NSJSONReadingMutableContainers error:&error];
NSLog shows me for the first image value:
NSLog(@"%@", content);
image = 0;
I have a UICollectionView where I want to set an image from the URL. If the value "image" is false, i want to put an other image, but i dont know how to check if it is false.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if ([[[content objectForKey:@"name"] objectAtIndex:indexPath.row] objectForKey:@"image"] == nil)
I also tried "== false" "== 0" but nothing worked.
Anyone has an idea?