Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing data to the correct data-type #36

Open
t0chas opened this issue Aug 30, 2016 · 0 comments
Open

Parsing data to the correct data-type #36

t0chas opened this issue Aug 30, 2016 · 0 comments

Comments

@t0chas
Copy link

t0chas commented Aug 30, 2016

Hi,

I came across this issue, when fetching data from a REST service a value that should be conformed as string value is being delivered without the quotes when the value is a number. Causing the mapping to parse and assign a long value to a string property.
The problem raises when assigning the string property to almost any UIKit object property.

{
  "id": 102,
  "challenge_id": 19,
  "start_timestamp": "2016-08-30 16:13:25",
  "end_timestamp": "2016-08-31 23:55:00",
  "match_date": "2016-09-01",
  "nfl_week": 4,
  "tie_question": "The most passing yards this week?",
  "tie_answer": "",
  "num_swipes": 20,
  "has_results": 0,
  "status_id": 1,
  "created_at": "2016-08-30 16:12:53",
  "updated_at": "2016-08-30 16:12:56",
  "total_startorsits": 20,
  "completed_startorsits": 0,
  "total_players": null,
  "challenge_image_url": "46996a9b8bd243ac94de9fc3e578d447.jpg",
  "banner_image_url": "ef8c56fe6ade4cdcb5866490dd0cccf7.jpg",
  "challenge_price_title": 333333,
  "sport_id": 1
}

Here "challenge_price_title": 333333, is the offending key/value.

The property is defined as NSString*
Model

And here the debugger shows it has a value of type NSCFNumber
Debugger

Would it be possible to enforce the correct data type is assigned to the properties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant