Questions tagged [nsmutabledata]

NSMutableData (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers. It is available in OS X v10.0 and later and available in iOS 2.0 and later .Use this tag [tag:NSMutableData] for questions referring to NSMutableData in OS X or iOS platform .

From Apple Official Document NSMutableData class reference (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects. They are typically used for data storage and are also useful in Distributed Objects applications, where data contained in data objects can be copied or moved between applications.

NSData creates static data objects, and NSMutableData creates dynamic data objects. You can easily convert one type of data object to the other with the initializer that takes an NSData object or an NSMutableData object as an argument.

For more information : NSMutableData Class Reference

Related SO Questions:

NSMutableData remove bytes?

Is it okay to call +[NSData dataWithData:] with an NSMutableData object?

Related tags:

155 questions
1
vote
2 answers

Why would an empty NSMutableData be optional?

I'm converting a project from Objective-C to Swift. In it, there is a NSMutableData object that was originally instantiated like this: NSMutableData *buffer = [[NSMutableData alloc] initWithLength:65535]; In Swift, when I try to instantiate it the…
John Montgomery
  • 6,739
  • 9
  • 52
  • 68
1
vote
1 answer

NSMutableData to Int

I have a call to a URL and receive back a 0 or 1 on fail or success. I have my data in a NSMutableData *data; object. I get the data, but now want to see if it's a 1 or 0. How do I do this? Do I need to get the bytes? Thanks
David Nelson
  • 752
  • 1
  • 10
  • 27
1
vote
1 answer

NSMutableData error

Let me start to say that I'm new to iOS/Xcode programming so I don't know even what to ask exactly. I'm trying to add a static library to an app and I'm ending up with a crash. The library package has a .h file and a .a file. I'm asking for some…
thefwguy
  • 85
  • 1
  • 11
1
vote
1 answer

Decode data recieved from HTTP API request

So I am trying to use an API to request grades from our schools grading system in order to create an app that students can use to check their grades. I am using an NSURL request to fetch this data and it comes back in the form of NSMutableData. When…
woakley5
  • 304
  • 3
  • 17
1
vote
1 answer

How to revert action -[NSMutableData appendBytes:length:]?

From this link: - (void)process { _isProcessing = YES; int amountInBuffer = 0; int framesRead = 0; do { if (_data.length >= BUFFER_SIZE) { framesRead = 1; break; } if (_shouldSeek) { …
1
vote
2 answers

NSMutableData to NSDictionary returning null

I'm writing a program that uses the Instagram API and I'm running into some issues with NSMutableData and NSDictionary. Since I have to make multiple calls to the API, I decided to create a NSMutableData object, append smaller NSData objects to it…
S.G.
  • 71
  • 3
1
vote
2 answers

How to subclass NSMutableData

I am trying to subclass NSMutableData to add the ability to subdata without copying. Here is code @interface myMutableData : NSMutableData - (NSData *)subdataWithNoCopyingAtRange:(NSRange)range; @end @interface myMutableData() @property…
crab oz
  • 635
  • 7
  • 16
1
vote
0 answers

Should NSPurgeableData be reusable after its contents have been discarded?

I have some code using NSPurgeableData that was working, until my machine's memory usage started running high, at which point I started to get an exception thrown. This is the message in the exception: *** Terminating app due to uncaught exception…
Dov
  • 15,530
  • 13
  • 76
  • 177
1
vote
1 answer

how to represent a zero or nil double value in NSMutableData?

I have an array of double values that should be stored in an external file. I convert the array to NSMutableData and save the data to disk. Some of the double values are either missing (nil) or are zero (0.0). Missing values can be replaced by 0.0…
user965972
  • 2,489
  • 2
  • 23
  • 39
1
vote
1 answer

Objective-C, NSMutableData not released

My app sometimes reads data, uses it, then might need to read it again later. I noticed that if I read the data once it gets released, but if I happen to read it again it never gets released. Why is the data not released if read…
Joe Habadas
  • 628
  • 8
  • 21
1
vote
3 answers

Incompatible pointer types assigning to 'NSMutableData *' from 'NSData *'

I am getting ERROR "Incompatible pointer types assigning to 'NSMutableData *' from 'NSData *'" As per my knowledge it must be a warning instead of Error. So i think is there any issue with my Xcode Project setting? Here is the image of the…
Dipen Patel
  • 911
  • 2
  • 9
  • 22
1
vote
2 answers

How to pass to NSMutableData.appendBytes an array index position different from zero

I've an [UInt8] array containing ASCII codes and I want to create a String from it passing from a NSMutableData I use the method appendBytes and pass to it the swift array address and everything works fine The problem is when I need to pass a…
dafi
  • 3,492
  • 2
  • 28
  • 51
1
vote
1 answer

NSData PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk

Every time I try and open an image within an App I get the following errors: : ImageIO: PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk : ImageIO: PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk : ImageIO: PNG invalid PNG…
TheM00s3
  • 3,677
  • 4
  • 31
  • 65
1
vote
1 answer

How to create NSData out of Hexdump string?

I have an NSData of an image, now I want to append a few bytes to the NSData of the image, I have the bytes as the Hexdump string. I need to append this: 62706c69 73743030 23400000 00000000 00080000 00000000 01010000 00000000 00010000 00000000…
David Gölzhäuser
  • 3,525
  • 8
  • 50
  • 98
1
vote
2 answers

Can't initialize an NSMutableData with an NSData (which contains a png)

there is a error in my iPhone app. I use the CameraPicker to make and get a picture and then I give it to my methode sendPhoto, which will send the photo to TweetPhoto. Everything works great until I initialize an NSMutableDate with NSData. Here is…
Flocked
  • 1,898
  • 2
  • 36
  • 57