Questions tagged [nsarchiving]

36 questions
1
vote
1 answer

Saving CloudKit Record to Local File Saves all fields Except CKAsset

I am trying to save an array of CKRecords to the documents directory in order to have fast startup and offline access. Downloading the CKRecords from CloudKit works fine and I am able to use the CKAsset in each record without issue. However, when I…
JohnSF
  • 3,736
  • 3
  • 36
  • 72
1
vote
1 answer

Internal /bin/cp command failed. xCode compiler error

I'm working in Xcode trying to build a simple calendar app. As I tried to build and run I get this error /Users/Zach/Downloads/Xcode-beta.app/COnonts/Developer/Toolchains/XcodeDefault.xctoolchain/ usr/bin/bitcode_strip: internal /bin/cp command…
Zachary
  • 87
  • 1
  • 13
0
votes
2 answers

iOS - is there any framework serving huge amount of arbitrary binary data as plist or xml?

I know it is not good idea to use plist or xml for huge amount of arbitrary binary data for some performance reasons. Suppose my data format is an array of (some strings, an integer, binary data) where the size of binary data is over a few…
0
votes
2 answers

What is the correct way to unarchive data from NSuserDefaults?

I am storing some Objective C based objects in to NSuserdefaults. To retrieve data from NSuserDefaults, I use initWithCoder method. I have seen two different implementations of this: Implementation 1 - (id)initWithCoder:(NSCoder *)decoder { …
RK-
  • 12,099
  • 23
  • 89
  • 155
0
votes
1 answer

How to encode/decode [CKRecordZone.ID: CKServerChangeToken]?

public var zonesChangeToken: [CKRecordZone.ID: CKServerChangeToken]? { get { if(backingPreviousZonesChangeToken == nil) { guard let defaults: UserDefaults = UserDefaults(suiteName: CloudKitHandler.APP_GROUP_ID)…
erotsppa
  • 14,248
  • 33
  • 123
  • 181
0
votes
1 answer

How to encode/decode a dictionary with Codable values for storage in UserDefaults?

I am trying to store a dictionary of company names (string) mapped to Company objects (from a struct Company) in iOS UserDefaults. I have created the Company struct and made it conform to Codable. I have one example a friend helped me with in my…
0
votes
1 answer

Cocoa Bindings, String value in Defaults bound to a Text Field. How can I programmatically read this string?

I have a cocoa binding between UserDefaults and a TextField setup via IB: This works great, on every launch of the app the TextField will persist it's value However, I also want to read this string value programmatically in other places in code. I…
A O
  • 5,516
  • 3
  • 33
  • 68
0
votes
1 answer

Encode complex object swift 3.0

I already read several posts and tried every solution, nothing works in my case. I am using this complex data structure and need to store array of DrawnObjects in file. But it crashing when it first came to encode a variable which itself is an…
Chanchal Warde
  • 983
  • 5
  • 17
0
votes
1 answer

Archiving and Unarchiving in Swift 3.0

I have some problems regarding archiving and unarchiving data in swift 3.0. I read some posts about the same but still don't have complete clarity about some cases. enum (I used rawValue to archive it.) struct (I read about the extension method to…
PGDev
  • 23,751
  • 6
  • 34
  • 88
0
votes
0 answers

What is the best way to persist thousands of images on an iOS application?

I am building an iOS app and I would like to persist images. The images I persist have the potential to be in the thousands? I have read online that a common solution is to use the Documents/ directory. Is storing in the Documents/ directory a good…
AyBayBay
  • 1,726
  • 4
  • 18
  • 37
0
votes
0 answers

Getting two different IDs with same object using md5 in iOS

I am using md5 algorithm to archive credit card information in my app with the following method: - (NSString *)uniqueID { // nsobject --> nsdata -- > md5 hash --> hex string (30 chars) NSData *data = [NSKeyedArchiver…
Eric Chuang
  • 1,017
  • 9
  • 28
0
votes
1 answer

Is it possible to use NSKeyedArchiver to store an animated UIImage?

I loaded an image using frames downloaded from a web server. NSArray* frames = [self fetchFramesFromServer]; imageView.image = [UIImage animatedImageWithImages:frames duration:1.0]; Whenever I try to archive these frames, the encoding function…
Erika Electra
  • 1,854
  • 3
  • 20
  • 31
0
votes
1 answer

NSDictionary to custom class

I've a custom class QBChatDialog object, that I'm storing in sqlite database like -(void)storeInDB:(QBChatDialog *)dialog { NSString *query = = [NSString stringWithFormat:@"INSERT INTO dialogs (dialog_id,last_message) VALUES…
Sikander
  • 447
  • 4
  • 26
0
votes
1 answer

Unarchived object doesn't have the class descriptor of the archived object

I'm was writing unit tests and when I encountered a strange behaviour of NSKeyedArchiver/NSKeyedUnarchiver. The following is a failing test. Am I doing wrong? Here is a simple project to play with:…
0
votes
1 answer

Including data in iOS application bundle

So, I have a new requirement to include some data in my iOS app bundle (instead of having it downloaded via API call), because the data is quite large, and won't change often. My current setup is: Upon user login, I download the data (in json…
McDaddy
  • 144
  • 6