0

I am working on an app where i have to parse and show data in the app.

I am getting the image data in form of NSData which i am encoding and converting into UIImage so that it can be displayed on UIImageView, but something is going wrong and the image is not being displayed.

Following is the code I have done,

NSData *requestdata = [[[self.resultArray objectAtIndex:indexPath.row] objectForKey:@"profile_image"] dataUsingEncoding:NSUTF8StringEncoding]; // NSLog(@"Data is::%@",requestdata); UIImage* image = [[UIImage alloc] initWithData:requestdata]; [cell.profilePic setImage:image]; 

1 Answer 1

1

With that code you do not encode - decode anything. If you mean the images are encoded with base64(most common for images in json). Then you need to decode them before you init the image.

Be sure they are encoded and if they are you can try to decode with NSData categories from the following page

http://www.cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.