title: Objective-C: Get Image from JSON
body: <p>I am trying to learn web service on iOS.</p>
  
  <p>I'm starting of from getting an image from a JSON api link.</p>
  
  <p>I've used the code below but the image is not displaying and I'm getting warning that says</p>
  
  <blockquote>
    <blockquote>
      <p>Incompatible pointer types assigning to 'UIImage * _Nullable' from 'NSSting * _Nullable'</p>
    </blockquote>
  </blockquote>
  
  <p>My code</p>
  
  <pre><code>NSURL *urlAdPop = [NSURL URLWithString:@"JSON LINK HERE"];
      NSURLRequest *request = [NSURLRequest requestWithURL:urlAdPop];
      [NSURLConnection sendAsynchronousRequest:request
                                         queue:[NSOperationQueue mainQueue]
                             completionHandler:^(NSURLResponse *response,
                                                 NSData *data, NSError *connectionError)
       {
           if (data.length &gt; 0 &amp;&amp; connectionError == nil)
           {
               NSDictionary *AdPopUp = [NSJSONSerialization JSONObjectWithData:data
                                                                        options:0
                                                                         error:NULL];
               popUpBanner.image = [[AdPopUp objectForKey:@"ad_image"] stringValue];
               popUpAdURL = [AdPopUp objectForKey:@"ad_link"];
           }
       }];
  
  
  
      popUpBanner.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:popUpAdURL]];
      popUpBanner.hidden = NO;
      popUpBanner.layer.cornerRadius = 9;
      popUpBanner.clipsToBounds = YES;
      popUpBanner.userInteractionEnabled = YES;
      [self.view addSubview:popUpBanner];
  </code></pre>