nsdata Questions

2

Solved

Is NSKeyedArchiver appropriate to convert UIImage to Data? do { let data = try NSKeyedArchiver.archivedData(withRootObject: UIImage(named: somePath), requiringSecureCoding: true) ... } catch { ...
Coaptation asked 16/5, 2020 at 0:5

5

Solved

I'm communicating with a server in Swift retrieving image data. The incoming data is encoded as a base64 string. I am able to correctly receive and display the encoded strings. When I go to use the...
Shouldst asked 14/1, 2015 at 23:41

5

Solved

I worte these methods in Objective-C. They're just checksum and XOR some NSData - (void)XOR:(NSMutableData *)inputData withKey:(NSData *)key { unsigned char* inputByteData = (unsigned char*)[inpu...
Cockpit asked 1/4, 2015 at 4:33

31

Solved

I am implementing push notifications. I'd like to save my APNS Token as a String. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDev...
Atropos asked 21/2, 2012 at 5:48

4

I need to calculate exactly CRC-8-Dallas/Maxim. Can someone provide an algorithm? Any help is appreciated!
Incorporating asked 23/3, 2015 at 15:37

5

In working on a feed-reading iPhone app which displays nsdata's (html and pdf) in a UIWebView. I am hitting a snag in some PDF validation logic. I have an NSData object which I know contains a file...
Nostalgia asked 29/9, 2010 at 16:10

6

Solved

If I get a NSData which I know it's a image's data.But I don't know what format it is. So how can I identify which image format is it?Jpeg or PNG? PS:iOS
Ramonitaramos asked 2/9, 2011 at 9:2

11

Solved

I have a variable fileData of Data type and I am struggling to find how to print the size of this. In the past NSData you would print the length but unable to do that with this type. How to print...
Machellemachete asked 10/3, 2017 at 15:52

3

Solved

I have a UITextView with attributed text and allowsEditingTextAttributes set to true. I'm trying to convert the attributed string into a Data object, using the following code: let text = self.tex...
Vender asked 10/4, 2017 at 0:14

2

Solved

Evening, I'm trying to creating an APIClient, but I'm having a problem with a warning: APIClient.swift:53:81: Cast from 'Data' to unrelated type '[String : Any]' always fails In this code I'm try...
Pournaras asked 10/9, 2016 at 15:20

2

Solved

I have built a camera using AVFoundation. Once my AVCaptureStillImageOutput has completed its captureStillImageAsynchronouslyFromConnection:completionHandler: method, I create a NSData object lik...
Metope asked 22/10, 2013 at 20:41

2

I have file in XCode with name vvideo.mp4. I am trying to convert it to NSData like below NSData *data = [NSData dataWithContentsOfFile:@"vvideo.mp4" options:nil error:nil]; But as I log data, ...
Poleaxe asked 24/10, 2013 at 12:0

2

Solved

Code that was previously working in Swift 2.2 is now throwing the following error in Swift 3: Here is my code: let tempData: NSMutableData = NSMutableData(length: 26)! tempData.replaceBytes(in:...
Desta asked 16/8, 2016 at 16:3

7

Solved

I can create UIImage from NSData using [UIImage imageWithData:] or [UIImage initWithData:] methods. I wonder if I can get the NSData back from an existing UIImage? Something on the line of NSData...
Showpiece asked 7/1, 2011 at 9:1

4

Solved

I am curious to know if there is anything like the Cocoa NSData Class on Java. I have looked around but I can't find anything. I want to make a file sharing client server application.
Lenz asked 12/8, 2011 at 15:54

5

Solved

I have a struct containing a struct and an NSObject that I want to serialize into an NSData object: struct Packet { var name: String var index: Int var numberOfPackets: Int var data: NSData } ...
Carpous asked 7/3, 2015 at 15:34

14

How do I convert an NSString value to NSData?
Repartition asked 23/5, 2009 at 11:20

4

Solved

I am trying to upload an image to my server, but before uploading, i need to check whether it is valid format or not. let say i only want .jpeg and .png only, so if the users pick .gif format image...
Charlotte asked 21/12, 2017 at 0:26

7

Solved

I'm having problems converting a JSON element into NSData, and an NSData variable back into JSON in Swift. Firstly, I'd like to extract the encryptedData element of the following JSON data: { "t...
Geosphere asked 10/11, 2014 at 9:42

10

Solved

I'm trying to save a UIImage to NSData and then read the NSData back to a new UIImage in Swift. To convert the UIImage to NSData I'm using the following code: let imageData: NSData = UIImagePNGRe...
Pilsner asked 30/8, 2015 at 14:40

5

I have a gif image in my photo album. When I use the UIImagePickerController to select that image, I need to convert the image to NSData for storing. Earlier, I used NSData *thumbData = UIImage...
Instant asked 25/5, 2013 at 9:51

7

Solved

In Objective-C I use the following code to Convert an Int variable into NSData, a packet of bytes. int myScore = 0; NSData *packet = [NSData dataWithBytes:&myScore length:sizeof(myScore)]; ...
Spelt asked 23/2, 2015 at 18:20

2

Solved

Swift offers both Data and [UInt8] types, which do a very similar thing. What are the differences between the two? When designing new API's, what's the preferred type?
Schreib asked 5/10, 2016 at 11:55

6

Solved

I just renamed my Xcode project and when I ran it I got this error: 2015-11-14 05:32:42.337 Buck Tracker[3537:1456100] * Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationExc...
Dextrin asked 13/11, 2015 at 21:38

3

Solved

I want to append two NSData: var actionIdData :NSData = NSData(bytes: &actionId, length: 2) var payLoad : NSData = NSData(bytes: &message, length: 9) var messageData : NSMutableData! ...
Havana asked 3/9, 2016 at 8:38

© 2022 - 2024 — McMap. All rights reserved.