• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EXC_BAD_ACCESS in NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS in NSData


  • Subject: Re: EXC_BAD_ACCESS in NSData
  • From: Scott Ribe <email@hidden>
  • Date: Mon, 26 May 2014 09:03:15 -0600

On May 26, 2014, at 8:43 AM, Pax <email@hidden> wrote:

> I should, I know, find out what was going wrong initially - but since I'd rather not have a copy anyway, this really is the all-round better solution.

What was wrong was that instead of passing the address of the buffer you allocated, you were passing the address of the variable which held the address of the buffer.

But beyond that, the fact that you even tried:

unsigned char* bytes;
[datastream getBytes:&bytes range:NSMakeRange(positionCounter, datasize)]; // Packet content

and weren't sure whether it would work, indicates that you have a big gap in understanding pointers & memory, and this needs to be fixed or you'll continue to create crashing bugs, some of which will not be nice enough to show up every time you run the code ;-)

If you haven't already, studying a good tutorial on C or Objective-C is in order. If you have, then reviewing the sections on pointers and dynamic memory is in order.

--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >EXC_BAD_ACCESS in NSData (From: Pax <email@hidden>)
 >Re: EXC_BAD_ACCESS in NSData (From: Uli Kusterer <email@hidden>)
 >Re: EXC_BAD_ACCESS in NSData (From: Pax <email@hidden>)
 >Re: EXC_BAD_ACCESS in NSData (From: Sandy McGuffog <email@hidden>)
 >Re: EXC_BAD_ACCESS in NSData (From: Pax <email@hidden>)

  • Prev by Date: UICollectionViewCell and UIScrollView and autolayout
  • Next by Date: Re: EXC_BAD_ACCESS in NSData
  • Previous by thread: Re: EXC_BAD_ACCESS in NSData
  • Next by thread: UICollectionViewCell and UIScrollView and autolayout
  • Index(es):
    • Date
    • Thread