-1
UIImageView *imageView = [[UIImageView alloc] init];
[ImageViewHelper setImageURL:productInfo.ImageUrl forImageView:imageView];
CCSprite *imageSprite = [CCSprite spriteWithCGImage:imageView.image.CGImage key:productInfo.ImageUrl];

setImageURL: forImageView: is a multithreaded way, and when I perform to the third step, the imageView does not get loaded successfully, because it's done on a separate queue via multi-threading, but imageSprite needs the imageView.image to be valid.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Pis.Y.Chen
  • 13
  • 7

1 Answers1

0

If you are getting the data from a back ground thread, please try getting back onto the main queue while loading the image sprite:

dispatch_sync(dispatch_get_main_queue(), ^{});
Unheilig
  • 16,196
  • 193
  • 68
  • 98