This error will appear when you compile your project with Xcode 4.2. Because of the new mechanism named ARC(Automatic Reference Counting). You could check out the document here: Programming With ARC Release Notes .

It could happen in this way: 

CALayer *imageLayer = [CALayer layer];

imageLayer.contents = (id) image.CGImage;

It is pretty easy to fix this problem,

just change “id” to “objc_unretainedObject“.

Hopefully this could help you out a little bit. Enjoy coding 🙂