0

so there is a solution for this, that handles backward compatibility from ios 5.1 here

UIImage and NSCoding iOS 5.1

My problem is...it does not seem to work, at this point

if (![UIImage conformsToProtocol:@protocol(NSCoding)]) 
{
}

It skips right over this on my iphone 3gs which is on 4.3 Which would suggest it conforms to protocl NSCoding and then the compiler has a go at me saying there is an exception as uiimage does not respond to encodeObject? so now what i have resorted to is this

@try 
{
    [encoder encodeObject:_imageToSend forKey:kImageToSend];
}
@catch (NSException *exception) 
{
    NSLog(@"EXCEPTION @ PhotoImage : %@",exception);
}
@finally 
{
    [_imageToSend encodeWithCoderForArchiver:encoder];
}

I suspect i am not supposed to excplicitly call encodeWithCoderForArchiver but either way the category this woman has put down is malfunctioning OR more likely i am using it wrong.

Any suggestions?

Community
  • 1
  • 1
Genhain
  • 1,937
  • 1
  • 19
  • 38
  • 1
    I think you want H2CO3's previous solution to the question you linked: http://stackoverflow.com/questions/11950173/conditional-categories-in-mountain-lion/11950348#11950348 – Michael Kernahan Nov 08 '12 at 20:44
  • I did use a ios version comparison method which is a bit limited but it worked however after just adding UIImage class, it works fine...how odd. – Genhain Nov 12 '12 at 03:04

1 Answers1

0

change

 ![UIImage conformsToProtocol:@protocol(NSCoding)]

to this

![[UIImage class] conformsToProtocol:@protocol(NSCoding)]

And it seem to know what it is doing.

Genhain
  • 1,937
  • 1
  • 19
  • 38