-3

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];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
MNOman
  • 3
  • 3
  • [fbController addImage: i need to cgImageResult to addImage method of fbController. an hint? – MNOman Aug 30 '13 at 06:33

1 Answers1

1

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]; 
Fahri Azimov
  • 11,470
  • 2
  • 21
  • 29
  • [fbController addImage:[UIImage image]]; This is showing warning that class method +image not found(return type default to id) – MNOman Aug 30 '13 at 06:58
  • You are doing it wrong way. Do it like in my example. – Fahri Azimov Aug 30 '13 at 07:05
  • In take picture method i have write this. UIImage *image = [UIImage imageWithCGImage:cgImageResult]; and in share method that is a button i have write [fbController addImage:[UIImage image]]; – MNOman Aug 30 '13 at 07:08
  • kindly give me some example code to look at. – MNOman Aug 30 '13 at 07:10
  • i have put the UIImage *image; into .h file and than used your answer but it is throwing exception. – MNOman Aug 30 '13 at 07:32
  • 013-08-30 12:35:22.355 Mind Reader[16255:907] -[__NSCFString CGImage]: unrecognized selector sent to instance 0x1ed75db0 2013-08-30 12:35:22.356 Mind Reader[16255:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString CGImage]: unrecognized selector sent to instance 0x1ed75db0' these are the exceptions – MNOman Aug 30 '13 at 07:36
  • 1
    I would recommend you to read some objective c programming basics. – Fahri Azimov Aug 30 '13 at 08:28
  • Thanks buddy i got it worked when i called the Facebook share into take picture method instead of share method. i share method as i have mentioned earlier i got exceptions due to some release problems. thanks for your time. – MNOman Aug 30 '13 at 10:32