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 8301069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:48:29+00:00 2026-06-08T16:48:29+00:00

I get NSImage like that: imageG = [[[NSImage alloc] initWithSize:NSMakeSize(imageN.size.width, imageN.size.height)] autorelease]; [imageG addRepresentation:[NSCIImageRep

  • 0

I get NSImage like that:

imageG = [[[NSImage alloc] initWithSize:NSMakeSize(imageN.size.width, imageN.size.height)] autorelease];
[imageG addRepresentation:[NSCIImageRep imageRepWithCIImage:result]];

And the result is really good. So there are no mistakes i think. And then I try to convert this image to NSData like that:

 NSData *imgData = [imageG TIFFRepresentation];

And i am getting error:

Thread 1: EXC_BAD_ACCESS (code=13, adress=0x0)

at that line. Where is my mistake?

  • 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-08T16:48:36+00:00Added an answer on June 8, 2026 at 4:48 pm

    You need to retain your object as you create it, it appears it’s being reallocated by the time you ask it for its data reorientation.

    imageG = [[[[NSImage alloc] initWithSize:NSMakeSize(imageN.size.width, imageN.size.height)] retain] autorelease];

    Generally if you create an object from an initializer – not a factory method – you should retain and auto release it. The benefits of doing so, and other good tips on memory management can be found at: Why should a self-implemented getter retain and autorelease the returned object?

    It’s also to handy to note that BAD_ACCESS indicates a memory issue of some kind.

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

Sidebar

Related Questions

Whenever I do: xxx = [NSImage imageNamed:@Package.png]; xxx loads but it's width and height
//Get width and resize another element $(document).ready(function() { function ResizeSearch(GridID, SearchID) { var eleWidth
I used the codes below to display an image NSImage *image = [[[NSImage alloc]
When using NSImage 's imageNamed: method to get the icon for the current computer,
I have an NSImageView which I get an image for from an NSOpenPanel. That
If I create an NSImage via something like: NSImage *icon = [NSImage imageNamed:NSImageNameUser]; it
I have some Code that I'd like to share between an iOS and an
Get class from div inside an li and add to the same li. The
get an array of bluetooth ID's Broadcast the bluetooth signal manually
GET is a convenient method to post the form id, post the website id

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.