Support Topics Documentation Slack YouTube Blog

NSDate vs Date in API Client SDK for iOS

I think I’ve found a repeatable issue:

  1. A table has a DateTime column in the schema
  2. A custom Java API is written to do a RETRIEVE on a row from the table
  3. Download the iOS Client SDK
  4. Implement the API call in xCode/Swift, doing a retrieval of a row in the table
  5. The selection call will fail with an error similar to the following

-[__NSCFString timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x600002479da0

  1. Change the data type of the column in the NSObject from Date? to NSDate?
  2. Re-run the API call, with a successful call

I have been able to switch back and forth on the datatype and repeatably go from success to fail. No other changes in the code

The reason I’m bringing this up is:

  1. Can the steps above be repeated?
  2. If a new revision of the custom API is deployed, and the client SDK is downloaded, the downloaded package of NSObject swift files will have Date? again the developers will have to remember to re-do the correction to NSDate?

Thanks,

Mark

Hi @Mark_Moline,

This is something our iOS experts will address. Something to clarify though, are you using our Objective-C or the Swift SDK?

Regards,
Mark

Hi @Mark_Moline

Can you please provide your App ID and the code sample that reproduces your issue?

Best Regards,
Maksym

Yes, sorry. I was away from computer access for a few days.

I am using Swift SDK. App ID = ‘5571A518-B5D9-43D0-8B58-D285A3CE1E74’ I can DM the sample the iOS Sample SDK project, or you can download it from the app. please let me know which you prefer.

Thanks,

Mark

NSString *dateStr = @"2016/12/20 12:53:58 +0000";
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy/MM/dd HH:mm:ss Z"];
NSDate *date = [dateFormat dateFromString:dateStr];

Mario,

I’m not sure what you are posting? I’m using Swift SDK. Thanks!

Hello @Mark_Moline,

I can reproduce this issue.
The internal ticket BKNDLSS-21294 is created. It would be fixed as soon as possible but it is related to another ticket BKNDLSS-21294 so it may take some time.

Regards,
Olha