Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • that was a typo. I am using it as a global variable: _finalPhotoTosend. Either way, that's not the problem. I need to figure out a solution in regards to getting the NSData from the object. Commented Mar 2, 2014 at 23:24
  • can you edit your question to show you how set the "finalPhotoToSend" property? Commented Mar 2, 2014 at 23:26
  • just to be sure, I did include the statement: sendFriendsVC.finalPhotoToSend = _subLayer.contents; But I will edit the question and add the full IBAction that contains this statement. Commented Mar 2, 2014 at 23:29
  • Oh yeah, there I see it. So when you do "_subLayer.contents = (id)[UIImage imageWithCGImage:imageRef].CGImage", you're setting ".contents" to a CGImage and not a UIImage. And you can't do "UIImageJPEGRepresentation" off a CGImage. No wonder you're getting that exception. Commented Mar 2, 2014 at 23:30
  • I understand, but then why am I able to store this CGImage in the UIImage object finalPhotoToSend? Even though I'm storing it in a UIImage, is it technically still a CGImage? Commented Mar 2, 2014 at 23:33