Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error while using NSVlaueTransformer to transform image to NSData

this's my PictureDataTransformer.m

#import "PictureDataTransformer.h"

@implementation PictureDataTransformer

+(Class)transformedValueClass
{
return [NSData class];
}

+(BOOL)allowsReverseTransformation
{
  return YES;
}

-(id)transformedValue:(id)value
{
    return UIImagePNGRepresetation(value); 
}

error Implicit declaration of function 'UIImagePNGRepresetation' is invalid in C99 Implicit conversion of 'int' to 'id' is disallowed with ARC

-(id)reverseTransformedValue:(id)value
{
  UIImage *image = [UIImage imageWithData:value];
}

error 2 Use of undeclared identifier 'UIImage' return image;

@end

and I have 2 errors and I don't know why

like image 388
MEH Avatar asked Mar 04 '26 17:03

MEH


1 Answers

Looks like you've made a typo in UIImagePNGRepresentation - you're missing an "n".

Also, the undeclared identifier issue makes me think that you haven't imported UIKit.

like image 111
stefandouganhyde Avatar answered Mar 07 '26 07:03

stefandouganhyde