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

  • SEARCH
  • Home
  • 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 9221043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:29:21+00:00 2026-06-18T03:29:21+00:00

I am using base64encoding for sending an UIImage to the server and then on

  • 0

I am using base64encoding for sending an UIImage to the server and then on the other end i am getting it back, converting the base64encodedstring in to NSData then trying to get my image back on an UIImageView.

Everything working fine sending the Base64encodedString and receiving it but when i am converting the NSData back in to UIImage it is throwing the following exception

-[__NSArrayI dataUsingEncoding:allowLossyConversion:] exception is comming with Base64 encoding

this is the code i am using for posting the image:

img=mainImage.image;
NSData *imgdata=UIImagePNGRepresentation(img);
NSString *imgstring=[imgdata base64EncodedString];
NSString *post =[[NSString alloc] initWithFormat:@"gid=%@&image=%@",[lblgid text],imgstring];
NSLog(@"PostData: %@",post);

NSURL *url=[NSURL URLWithString:@"http://www.abcd/updategameimage.php"];

And following is the code at receiving end

 NSString *imgStr=[abc valueForKey:@"image"];
    NSLog(@"%@",imgStr);
    NSData *imgdata=[NSData dataWithBase64EncodedString:imgStr];


    imge = [UIImage imageWithData:imgdata];

    [imgview setImage:imge];

Here abc is NSMutableArray

  • 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-18T03:29:22+00:00Added an answer on June 18, 2026 at 3:29 am

    Are you sure abc is a mutableArray?

    Because you are sending it a valueForKey: method. This is a KVC method implemented by NSObject and it doesn’t make sense to send it this message.

    If you meant to send it the objectForKey: method instead – then that would be a message that you send to dictionaries, not arrays.

    And, the error that you are getting:

    -[__NSArrayI dataUsingEncoding:allowLossyConversion:] exception is comming with Base64 encoding

    is telling you that an NSArray does not respond to dataUsingEncoding:allowsLossyConversion: messages – which is a method for NSString objects.

    I think you are getting confused with your object types and need to get a better handle on what is what.

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

Sidebar

Related Questions

PHP5.2.x back end. The text data transfer is using JSON objects. Am looking at
Using SQL Server 2008 R2 we are looking for a way to select the
Using the Redis info command, I am able to get all the stats of
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
Now i am using GWT , I am trying to change the image path,
My RoR server receives a string, that was encrypted in C++ application using des3
I'm trying to convert an image into base64 using javascript, however if I request
I have been struggling with trying to send an email with an attachment using
Iam using base64 encoding for authentication to contact a dot net server and for
I am using in App purchases in my application. I am sending a request

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.