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

iOS - Download an HTML web page, search through the content and set text to a label based on query result

what I want: Download a webpage from a server > Save content in a NSString > Search through the content via IsEqualToString > Set text to a label when a specified keyword was found. I was able to download the webpage, show content in a UITextView…
user1010563
2
votes
2 answers

Difference between NSMutableData's mutableBytes and bytes methods

Both return the same pointer. I know - bytes belongs to NSData, why does NSMutableData introduce - mutableBytes? Is it just for code clarity so it is more obvious you are accessing mutable data? Does it really matter which one is…
Ivan Dossev
  • 565
  • 5
  • 11
2
votes
1 answer

NSMutableData, process received data then delete from beginning/reuse buffer?

This may be an easy one. I'm using GCDAsyncSocket to receive a variable amount of bytes representing discrete data chunks from a server which appear in a NSMutableData object. If the data were words it might look like…
Adam Eberbach
  • 12,309
  • 6
  • 62
  • 114
2
votes
4 answers

memory leak with NSMutableData

I have a class for connecting with httprequests. I am getting a memory leak for "NSMutableData" altho I am releasing it in "didFailWithError" and in "connectionDidFinishLoading" of the connection object: - (BOOL)startRequestForURL:(NSURL*)url…
Yaniv Efraim
  • 6,633
  • 7
  • 53
  • 96
2
votes
0 answers

How to Append PDF files in iOS SDK

I would like to append pdf files, i ll be getting NSData from server which i am saving as PDF, i want to add more data to existing PDF, i tried appending NSData which is appending the no.of bytes but if i save it as PDF then it only saves the…
user645903
  • 21
  • 2
2
votes
0 answers

reading data compressed by NSMutableData using the lz4 library in python

I'm compressing random data using NSMutableData (in Swift) as follows: import Foundation let n = 1024 let numbers = (0..
Taylor
  • 5,871
  • 2
  • 30
  • 64
2
votes
1 answer

Objective-c/IOS: Reversing the bytes in NSMutabledata

In my application I have the bytes of an audio file stored in NSMutableData like so: NSMutableData *data = [NSMutableData dataWithBytes:byteData length:len]; I can then later play this using player = [[AVAudioPlayer alloc] initWithData:data…
2
votes
1 answer

Saving Data as UIImage while preserving the original image characteristics

I am removing exif and location metadata from images using Photos and image I/O frameworks: First I get Data from PHAssets: let manager = PHImageManager() manager.requestImageData(for: currentAsset, options: options) { (data, dataUTI, orientation,…
HemOdd
  • 697
  • 1
  • 7
  • 23
2
votes
2 answers

Using the bytes of an NSMutableData instance while allowing it to be autoreleased

I've been using NSMutableData* mutableData = [NSMutableData dataWithLength: someLength]; void* bitmapData = [mutableData mutableBytes]; CGContextRef context = CGBitmapContextCreate(bitmapData,...); // ...use context CGContextRelease(context); I…
eugene
  • 39,839
  • 68
  • 255
  • 489
2
votes
3 answers

NSMutableData to NSString conversion fails if special character present

I'm writing an app to interact with a DirecTV receiver through the http server interface. I'm able to query the device and get the SJON formatted response. Here is my sample code: - (NSDictionary *) readDVRData { NSMutableData *rData =…
Dave
  • 25
  • 4
2
votes
0 answers

Migrating NSData to Data from swift 2 to swift 3

Yesterday I upgraded XCode and used Apple's translator to change the code from Swift 2 to Swift 3. Of course there were errors, most of them easy to fix, but there is one that is killing me. I am making a NSMutableURLRequest. In swift 2, to set the…
2
votes
0 answers

When creating NSMutableData, memory usage doesn't change

When I create an 8MB NSMutableData object my memory usage does not seem to change. Is it normal? My code is as following: NSMutableData *myData; myData = [[NSMutableData alloc] initWithLength:(8*1024*1024)]; // init with 8 MB When I debug step by…
Dertron
  • 141
  • 1
  • 8
2
votes
0 answers

'[UInt8]' or NSData/NSMutableData in Swift?

Simple question: What should we prefer if we have to deal with raw bytes in Swift: [UInt8] or NSData and NSMutableData, respectively? What are the advantages/disadvantages using one over the other?
Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
2
votes
1 answer

NSMutableData initWithCapacity absurd capacity?

I have these methods that handle a download But there is an error when initialize NSMutableData NSNumber *filesize; NSMutableData *data; - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { filesize =…
Fabio
  • 1,913
  • 5
  • 29
  • 53
2
votes
1 answer

Need to extract XML document from NSMutableData object in iOS

I am successfully connecting to a .NET web service from iOS and print the response xml document to the console via NSLog. This I am doing via the AFNetworking Library. I am now able to connect to this same web service via NSURLConnection, however,…
syedfa
  • 2,801
  • 1
  • 41
  • 74
1
2
3
10 11