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
3 answers

Curious, is it possible to get [UIImage] from NSMutableData

On my iOS side, i received a stream of images via NSInputStream. NSMutableData will be containing images in [JPG IMAGE][JPG IMAGE][PNG IMAGE]. Is there any elegant way of getting the images from NSMutableData? EDIT: Thanks for all the replies. I…
perwyl
  • 323
  • 3
  • 14
0
votes
1 answer

iPhone Objective-C, malloc or NSMutableData?

I'm need to use a volitile block of memory to constantly write and rewrite the data inside using multiple threads. The data will be rendered thread-safe using @synchronized if I utilize either malloc'd data or NSMutableData. My question is what is…
0
votes
1 answer

Xcode NSMutableData replaceBytesInRange CPU usage

I am writing an Mp3 player. I am downloading mp3 files from server. Files are encrypted. Encrypt method of my customer is very easy. They just insert a single bit per X byte. Like 323 in code. But decryption process take very long time. And CPU…
Can Ürek
  • 641
  • 12
  • 24
0
votes
1 answer

Cast or convert AnsiString to NSMutableData in Objective Pascal unit over Cocoa classes

Writing a Lazarus unit with Objective Pascal to interface with Cocoa classes on Mac OS X. I want to pass an AnsiString from the FreePascal caller to a Cocoa class requiring an NSMutableData parameter value. How can I cast or convert the AnsiString…
Lor
  • 141
  • 10
0
votes
2 answers

Converting INT to Hex string to be sent over BLE

I am trying to convert several 'int' values to hex so that they can sent over bluetooth as a command. I have tried numerous things, but while I get the same result with different methods, I cannot get the desired result to send over BLE so that the…
WrightsCS
  • 50,551
  • 22
  • 134
  • 186
0
votes
1 answer

Image upload using curl - ios

I am uploading image to backend. CURL Command: curl -i -X POST -F filedata=@file_logo.jpg http://upload.com/projects/ media/add_image/44/8 I am using the below code: NSData *editedImage = [NSData…
0
votes
2 answers

handling response with NSURLConnection

I have created an array of NSURLConnections, as I am running through a for loop and creating multiple NSURLConnections. Here is my code for(int i = 0; i
Ranjit
  • 4,576
  • 11
  • 62
  • 121
0
votes
1 answer

Login error with iOS Swift: fatal error: unexpectedly found nil while unwrapping an Optional value

i need your help cause i cant use this piece of code. I was using it in obj-c and now i want to use it with iOS swift, but when i simulate it, there is an error when using webData cause it's nil, but i don't know how to fix it cause its the same…
Norolim
  • 926
  • 2
  • 10
  • 25
0
votes
1 answer

How do I create uint8_t with byte data?

I am trying to create uint8_t data with 2 bytes, and when I log the information after I have created it the saved information is incorrect(Or I am misunderstanding the LLDB logs). uint8_t…
Nathan
  • 1,609
  • 4
  • 25
  • 42
0
votes
2 answers

How to find why NSMutableData is invalid

I access a RESTFUL url and get back results. The results are in JSON. I turn the response into a string via: - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *json = [[NSString alloc] initWithBytes:[self.receivedData…
4thSpace
  • 43,672
  • 97
  • 296
  • 475
0
votes
2 answers

Warning at didReceiveDate method from NSURLConnection

At following method the compiler is showing a warning. buffer is a NSMutableData declared in the header file. This is the warning message: Local declaration of 'data' hides instance variable And this is the method which throws the warning: -…
mvasco
  • 4,965
  • 7
  • 59
  • 120
0
votes
1 answer

Uploading an image to php server from iphone

I am trying to upload an image to server following is iphone and php code // create request NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; …
Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193
0
votes
0 answers

How to know if Objective C class cleans memory that it internally created with malloc under ARC?

I use NSMutableData class in my iOS program. I get unbounded memory growth. I use Automatic Reference Counting. When I used allocation instrument, I saw that NSMutableData's initWithLength: method having Malloc calls in order to allocate memory.…
neo
  • 1,952
  • 2
  • 19
  • 39
0
votes
2 answers

How to remove bytes from the end of NSMutableData object

I have a NSMutableData object that is giving me some trouble, I am trying to remove the last 6 bytes from the object like this NSMutableData *reducedDataPacket = [[NSMutableData alloc] init]; reducedDataPacket = [myCompressedData…
HurkNburkS
  • 5,492
  • 19
  • 100
  • 183
0
votes
1 answer

Reserve contiguous space in memory with NSMutableData

How can I force NSMutableData to reserve contiguous memory, in the same section? I have a fair amout of data arriving piece by piece, and the performance is not satisfactory. The total size of my data will be constant.
Jose Alberto Diaz
  • 155
  • 1
  • 3
  • 12