Questions tagged [nsdata]

The NSData class is an Apple class for holding generic data. Often used when reading/writing from and to files, and the internet.

From the Apple Developer Library:

NSData and its mutable subclass NSMutableData 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.

NSData creates static data objects, and NSMutableData creates dynamic data objects. NSData and NSMutableData 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.

The size of the data is subject to a theoretical limit of about 8 ExaBytes (in practice, the limit should not be a factor).

2485 questions
0
votes
1 answer

Get value of bit from bytes | Swift 5

i need an help. So i'm getting bytes from BLE device, and i need to get a battery level. This is returned by Uint8 Bytes. So my works code (with comment): func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic:…
Mr. Developer
  • 3,295
  • 7
  • 43
  • 110
0
votes
3 answers

How to serialize NSImage to an sql script in order to import it in a blob column?

My iphone app uses a SQLite database to store data. I have a table with a blob column where i store my images. When i do an update i don't want to overwrite the user's database, i want to execute some sql scripts and inject new data if needed. I…
Sorin Antohi
  • 6,145
  • 9
  • 45
  • 71
0
votes
0 answers

What method will be called when execute a po command

I used thought that when i execute a po command in lldb ,e.g po nsdataObject the nsdataObject's description method will be called . But in iOS13 ,if i po a nsdataObject it will print all bytes. (lldb) po profileData <308225c8 06092a86 4886f70d…
ximmyxiao
  • 2,622
  • 3
  • 20
  • 35
0
votes
3 answers

Do you need to release NSData?

-(void) func1: (NSData*) somedata { //Processing somedata .... [somedata release]; //is it necessay? }
lilzz
  • 5,243
  • 14
  • 59
  • 87
0
votes
1 answer

NSDATA description returning nil

NSData description returning nil and making the NSData object nil. My code has stopped working and I would like to get this working again. If I compile my code in Xcode 10 it will get the NSData description fine. But if I use Xcode 11 it will give…
JC Castano
  • 135
  • 1
  • 6
0
votes
0 answers

How do I manipulate binary digits in Data or NSData object using Swift in an iOS Xcode project or an Xcode Playground?

I am using Swift in an iOS Xcode project. I would like to use the Data or NSData object in the Apple Foundation and UIKit Frameworks to manipulate binary data so that each binary digit represents a boolean value -- 0 being false, and 1 being…
daniel
  • 1,446
  • 3
  • 29
  • 65
0
votes
2 answers

Convert Data to Bool

I have an api call which its response is a data including a bool. it is NOT a JSON object so JSONDecoder fails to decode it. it's some bytes that needs to be converted to a Bool. respose in postman: true or false what is requested : let dataTask…
Mehrdad
  • 1,050
  • 1
  • 16
  • 27
0
votes
4 answers

How to convert NSData into string in iPhone SDK?

I am developing an iPhone application in which camera image store in NSData through UIImageJPEGRepresentation now i want to convert this NSData into string. After goggling I found base64 will do this. I want to know that if i encode it into base64…
Apekshit
  • 767
  • 2
  • 13
  • 27
0
votes
1 answer

Frustrating EXC_BAD_ACCESS (NSData / OpenGL related?) on device - works fine on simulator

This one is driving me mad. I recently introduced some code that stores image data from an OpenGL view in a NSData object, and stores that in Core Data. On retrieving this, and attempting to draw this pixel data back to a texture, I am receiving an…
Stuart
  • 36,683
  • 19
  • 101
  • 139
0
votes
1 answer

Xamarin Forms IOS - NSData from a json string

I'm trying to get an NSData from a json string, to use it later to create an MGLShape (From Mapbox SDK) like this: MGLShape.ShapeWithData(jsonData, 4, out error); //jsonData is the NSData, 4 is the nuint for the type of encoding and ou error is a…
Ricardo Dias Morais
  • 1,947
  • 3
  • 18
  • 36
0
votes
1 answer

NSData needs to be updated

I am parsing HTML using hpple. so now I want my text to be updated as the user touches the next button. my code looks something like this NSURL *ur = [NSURL URLWithString:[NSString stringWithFormat:@"%@",url.text]]; NSData *htmlData = [NSData…
Tushar Chutani
  • 1,522
  • 5
  • 27
  • 57
0
votes
0 answers

write and read NSData from external hardrive

I am searching for a way to write and read data from xcode program to an external hard drive. If I navigate to my external hardrive via finder and go to video right click hold options and copy file path i get this. /Volumes/GoPro…
Charlie
  • 222
  • 3
  • 20
0
votes
2 answers

Could not cast value of type __NSCFDictionary to NSData only when app is not fresh installed

When this code runs on a fresh app install, it works perfectly fine. However, when there is no data previously saved on the device, this function causes the app to crash. I get the error Could not cast value of type __NSCFDictionary to NSData and it…
Frank Doe
  • 192
  • 1
  • 3
  • 17
0
votes
1 answer

Convert Core Data to NSString

I want to create a backup function in my app iCollege (App Store). The data should be sended via email to any email address. I'm able to send it as attachement but I want to send it as a link. Is it possible? I tried to load the Core Data file in…
Paul Warkentin
  • 3,899
  • 3
  • 26
  • 35
0
votes
0 answers

Convert iOS image data to corresponding bitmap object in Android

How can we convert nsdata bytes array of an image in iOS to the corresponding Bitmap bytes array in Android? Thanks in advance!
xuanloctn
  • 81
  • 1
  • 1
  • 8
1 2 3
99
100