Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8005425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:13:42+00:00 2026-06-04T17:13:42+00:00

i try to encode an array with UIImages. Then i call save function NSString

  • 0

i try to encode an array with UIImages.

Then i call “save” function

NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"SavedUserData"];
[NSKeyedArchiver archiveRootObject: self toFile:filePath];

i get exception for line
[encoder encodeObject:recipePhotoList forKey:@"recipePhotoList"]; //array with images

 -[UIImage encodeWithCoder:]: unrecognized selector sent to instance 0x1b1380
2012-03-23 11:59:43.694 fishmarket[261:1a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage encodeWithCoder:]: unrecognized selector sent to instance 0x1b1380'

On 5+ iOS its working perfectly, on 4.3 i have this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:13:44+00:00Added an answer on June 4, 2026 at 5:13 pm

    some alternative to encode/decode UIIMage for iOS < 5.0

    + (void)saveImage:(UIImage*)image withName:(NSString*)imageName
    {
        if (image != nil)
        {
            NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
            NSString* documentsDirectory = [paths objectAtIndex:0];
            NSString* path = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithString:imageName]];
            NSData* data = UIImagePNGRepresentation(image);
            [data writeToFile:path atomically:YES];
        }
    }
    
    + (UIImage*)loadImageNamed:(NSString*)imageName
    {
        NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString* documentsDirectory = [paths objectAtIndex:0];
        NSString* path = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithString:imageName]];
        UIImage* image = [UIImage imageWithContentsOfFile:path];
        return image;
    }
    

    hope its help somebody.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try this: $test = array (2+2); var_dump($test); Then try the same but inside a
If I try to encode the url http://herthabsc.de/index.php?id=3631&tx_ttnews[tt_news]=13144&cHash=9ef2e9ee006fb16188ebf764232a0ba9 with urlencode() or http_build_query() it gives
So I'm trying to save an array when the app terminates so that I
Am trying to pass an array of values from PHP function to Javascript. Not
I am trying to declare a function parameter inside my array, but I'm having
Im trying to encode into a NSValue an multidimensional array of structs. This is
I want to encode Danish characters before sending them to database. I try to
Im having trouble with mvc decoding my encoded HTML string when I try to
I have a problem with sax parser and encoded text. I try to parse
Try to change submodule as described in git book $ git rm -r vendor/html-minifier

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.