how to share CGImageRef to facebook using social library?

52 views Asked by At

This is the method that have the image data, that image will than write to camera roll

CGImageRef cgImageResult = [self newSquareOverlayedImageForFeatures:features
                                                                                       inCGImage:srcImage 
                                                                                 withOrientation:curDeviceOrientation 
                                                                                                                 frontFacing:isUsingFrontFacingCamera];

                                  if (srcImage)
                            CFRelease(srcImage);

                        CFDictionaryRef attachments = CMCopyDictionaryOfAttachments(kCFAllocatorDefault, 
                                                                                    imageDataSampleBuffer, 
                                                                                    kCMAttachmentMode_ShouldPropagate);
                        [self writeCGImageToCameraRoll:cgImageResult withMetadata:(id)attachments];
1

There are 1 answers

8
Fahri Azimov On BEST ANSWER

Convert the CGImage to UIImage like so: UIImage *image = [UIImage imageWithCGImage:<#(CGImageRef)#>]; and post it to facebook as you have mentioned on your comments. Good Luck!

EDIT Okay, do it like this:

UIImage *image = [UIImage imageWithCGImage:cgImageResult];
[fbController addImage:image];