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
0
votes
1 answer

Getting length of NSMutableData

I have managed to NSInputStream and read some data to NSMutableData object. I am able to put this data into string and NSLog it, however when I try to access its length(I am assuming this is its size in bytes) my app crashes. NSString…
stringCode
  • 2,274
  • 1
  • 23
  • 32
0
votes
1 answer

appending erased file has too much disturbed noice

I am erasing audio file using following code: NSMutableData *wave =[NSMutableData dataWithContentsOfURL:self.recordedFileURL options:NSDataReadingUncached error:nil]; NSUInteger length = [wave length]; Byte *byteData =…
Pooja
  • 21
  • 2
0
votes
2 answers

Accessing NSMutableData from another class

Ok I have declared the NSMutableData in the .h of class 1 as followed NSMutableData *dataResponse; @property (strong, nonatomic) NSMutableData *dataResponse; in the .m of class 1 I have @synthezie dataResponse, and then I am giving it some data in…
Popeye
  • 11,839
  • 9
  • 58
  • 91
0
votes
1 answer

Using NSKeyArchiver to save data, but when I use NSKeyUnarchiver to load the data it is all 0 or nil

I'm trying to save the objects called blobs using NSKeyedArchiver. I use NSMutableData and NSKeyedArchiver to save the data onto a file that represents that object. then I use NSData and NSKeyedUnarchiver to get the data from the files. It seems to…
Telinir
  • 139
  • 1
  • 11
0
votes
1 answer

Details of header info for a video file format

I need to append 2 video files by appending their NSMutableData as I have already done this with audio files and it is done correctly but not with video files. It may be because data bytes contain some header info and I will need to remove these…
Pooja
  • 21
  • 2
0
votes
2 answers

NSMutableData capacity on length change

What happens with NSMutableData initialized with 1Mb capacity if I put 10Mb of data into it and then set length to zero? Does it shrink capacity back to initial value or leaves it as is (10Mb at the moment)? So basically I need to shrink whole data…
pronebird
  • 12,068
  • 5
  • 54
  • 82
0
votes
1 answer

NSData subdataWithRange crashing

I have the following code and I am getting an exception with it. -[_NSInlineData replaceBytesInRange:withBytes:]: unrecognized selector sent to instance 0x6000027ff2e0' terminating with uncaught exception of type NSException Can someone point out…
0
votes
0 answers

NSMutableData increment the underneath pointer and pass it to other APIs

I have been given a task to replace all uint_8 * to NSMutableData. In the existing code, a lot of pointer arithmetic is done on uint8_t and then passed onto other APIs which also accept uint8_t *. However, when replacing uint_8 * with NSMutableData,…
0
votes
0 answers

Storing WAV using NSData and NSKeyedArchiver in Objective-C

I'm trying to archive an array with floats by using NSKeyedArchiver. The data is a WAV file with 40 seconds of audio, which should result in a file size of approx. 10.5 MB. First I was using NSMutableArray with [NSNumber numberWithFloat:], but the…
HTron
  • 337
  • 3
  • 14
0
votes
1 answer

Appending and extracting objects from NSMutableData

I need to create create a data stream that contains multiple parameters, send it over the network and then extract those parameter when I receive the data. This is how and create my data (I'm certain all of my variables contain a value) let…
Gama
  • 352
  • 2
  • 16
0
votes
1 answer

Weird bug - can access NSURLConnection & NSMutableData's description method, but not their ivars

so I got class: DataFetcher.h #import @interface DataFetcher : NSObject { NSURLConnection *networkConnection; NSMutableData *recievedData; BOOL isFetchingFinished; } @property (nonatomic, retain)…
Jackless
  • 171
  • 1
  • 2
  • 4
0
votes
2 answers

Class return NSMutabledata

I want to write a class which return NSMutableData, i have this code but couldn't manage how it return self. any help would be great. @interface ITumblr_QueryTumblr : NSMutableData { NSURLConnection* connection; NSMutableData* data; …
modusCell
  • 13,151
  • 9
  • 53
  • 80
0
votes
1 answer

EXC_BAD_ACCESS accessing an NSMutableData

I´m getting an EXC_BAD_ACCESS when I trying to acces to the data, I suppose it is because I trying to acces to the internal data, but I don´t know How to solve this, the code: //data->NSMutableData int identi; [data…
Gustavo
  • 785
  • 1
  • 12
  • 31
0
votes
1 answer

Swift - Sending binary file to a server (convert to string request)

Here is my function for building a request to send to a server. This code works perfectly fine when it's a small, plain-text file. However, when I pass it a binary file, it crashes on the line indicated below (when it tries to convert that to a…
svguerin3
  • 2,433
  • 3
  • 29
  • 53
0
votes
1 answer

Modifying too many bytes of Data object crashes swift app

I am creating an app where I need to modify specific bytes in a Data object, but it crashes when I modify too many bytes at one time. I thought the problem might be because my app was hanging for too long, but I put my code in a DispatchGroup and it…
Bytopo
  • 13
  • 3