i'm using fastttcamera wrapper avfoundation taking, processing , displaying picture. here's code (a fastttcamera delegate method) in cast (fastttcapturedimage *) (uiimage *):
- (void)cameracontroller:(fastttcamera *)cameracontroller didfinishscalingcapturedimage:(fastttcapturedimage *)capturedimage { //use captured image's data--note fastttcapturedimage cast uiimage nsdata *pngdata = uiimagepngrepresentation((uiimage *)capturedimage); //save image, , add path transaction's picpath attribute nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentspath = [paths objectatindex:0]; //get docs directory int timestamp = [[nsdate date] timeintervalsince1970]; nsstring *timetag = [nsstring stringwithformat:@"%d",timestamp]; nsstring *filepath = [documentspath stringbyappendingstring:timetag]; //add file name [pngdata writetofile:filepath atomically:yes]; //write file self.thistransaction.picpath = filepath; [self.viewfinder setimage:(uiimage *)capturedimage]; }
however, i'm getting sigabrt @ line:
nsdata *pngdata = uiimagepngrepresentation((uiimage *)capturedimage);
with console readout:
*** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[fastttcapturedimage cgimage]: unrecognized selector sent instance 0x17e2a100'
i'm confused reference cgimage. problem typecast? there no complaint on build. can please set me straight?
read docs fastttcapturedimage
. it's not uiimage
can't cast that. use provided property uiimage
.
change problematic line to:
nsdata *pngdata = uiimagepngrepresentation(capturedimage.fullimage);
you have same problem later:
[self.viewfinder setimage:capturedimage.fullimage];
btw - didn't problem while compiling because cast way tell compiler "trust me, it's i'm telling is". problem here wrong, it's not claimed was. :)
Comments
Post a Comment