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

Swift - Check if the file download from a URL is completed

I am downloading mp4 clips from a M3U8 manifest which can have around 700 clips. Everything works fine to download them but what would be the best to check individual downloads are finished? When all the clips are downloaded, I merge them into one…
STerrier
  • 3,755
  • 1
  • 16
  • 41
0
votes
0 answers

How to get image from NSOutputStream in Objective-C

I am using twilio chat SDK, in that I am doing store and retrieve the image. So to retrieve the image from twilio I am getting NSOutputStream, And I don't know that how to convert NSOutputStream to image. Please see the below code which provided by…
Mihir Oza
  • 2,768
  • 3
  • 35
  • 61
0
votes
2 answers

How to convert __NSCFString to NSData in Objective-C

Convert __NSCFString to NSData App crash when I try to get data from my NSDictionary NSData *routeData = [dictSelectedScheduleTrip valueForKey:@"routeSerialize"]; Crash Log [__NSCFString bytes]: unrecognized selector sent to instance…
Vivek
  • 4,916
  • 35
  • 40
0
votes
0 answers

Convert NSData into NSArray

I just need to get what exactly i can see in NSData to NSArray. the data i am getting <98009900 9a009b00 9c009d00 9e009f00 a000a100> I want it like [98,00,99,00,9a,00,9b,00,9c,00,9d,00,9e,00,9f,00,a0,00,a1,00] I used [NSKeyedUnarchiver…
Sai Dammu
  • 11
  • 2
0
votes
1 answer

How to write bytes in a NSData obj from a byte array at specified index

I've a byte array and I save it in an NSData object. Now I need to change only some chunk of this NSData object at specified index and save it to file. What is the best way to achieve this without using malloc of new byte array?
christian mini
  • 1,662
  • 20
  • 39
0
votes
1 answer

How to convert std::vector to NSData when using C++ file iOS project

When using C++ file for algorithm execution in iOS Project,I came across a problem where a function returns std::vector data of jpeg image. I have been searching for this particular question of how to convert from std::vector< uchar > to NSData and…
vinay
  • 351
  • 1
  • 5
  • 16
0
votes
1 answer

What is wrong with this code implementation? Objectice-c, IOS

Testing the relationship between NSData, NSMutableData And bytes method and Byte Type variables want to change NSData Value to Bytes, when i run this it crashes the app but doesnt throw any error.. This Runs Ok NSData *myData = [[NSData alloc]…
0
votes
1 answer

Why is saving UIImage data to UserDefaults ill advised?

I am wondering why storing user profile images as Data to user defaults is ill advised. The reason being: I have already created an app that has some people using it. The app requires that users create a profile, on which they can upload up to 6…
David Chopin
  • 2,780
  • 2
  • 19
  • 40
0
votes
1 answer

Converting NSData to Int returning garbage values in iOS

Data: <5b005c00 5d005e00 5f006000 61006200 63006400> Output: 6029403 The above data length is 20bytes, Its supposed to return value in the range of 0-100, Code I used: ppData = [ppData subdataWithRange:NSMakeRange(0, 20)]; int value =…
Sai Dammu
  • 11
  • 2
0
votes
0 answers

Is UIImage(data: Data) asynchronous?

My issue: I have reason to believe that initializing a UIImage from Data gums up my main thread a bit. It isn't terrible, takes a fraction of a second to complete, but it is noticeable as it makes my UI seem a bit glitchy. What I'm doing: I have a…
David Chopin
  • 2,780
  • 2
  • 19
  • 40
0
votes
0 answers

Sending only a chunk of data (over CoreBlueTooth)

I am working on an iOS app which needs to transfer audio data between to devices using CoreBlueTooth. This is the issue I am currently facing. First, the related Swift code: let path = Bundle.main.path(forResource: "\(name)", ofType: nil)!, url =…
Michel
  • 10,303
  • 17
  • 82
  • 179
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

Detached NSThread memory leak

With instruments i got a memory leak in this method of a detached thread : -(void)goToThisUrl:(id) targetUrl { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; if (someCondition) { // Doing some stuff here } //…
vince
  • 161
  • 1
  • 1
  • 6
0
votes
2 answers

Memory leak NSAutoreleasePool

With instruments i got a memory leak on this piece of code and i don't understand why! -(void)goToThisUrl:(id) targetUrl { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; if (someCondition) { // Doing some stuff here …
vince
  • 161
  • 1
  • 1
  • 6
0
votes
1 answer

CFArray to NSData to NSImage

I've got a plist file with jpeg photo data in it. I need to get that photo out. I can read the plist file into an NSDictionary and can access the object at the key "jpegphoto". The problem is that the object returned is an NSCFArray that I have no…
wmarbut
  • 4,595
  • 7
  • 42
  • 72
1 2 3
99
100