Skip to content

[iOS] JSON parsing error is showing up in log when openeing the Dasbhoard viewmodel #359

Closed

Description

@OmarIthawi

Steps to reproduce

  1. Where are you starting? What can you see?

A newly compiled app from develop branch connected to my server blue.zeitlabs.com which is Open edX master backend (more recent the Quince).

  1. What do you click?

The dashboard button.

We got this error in the mobile error:

valueNotFound(Swift.Array<Swift.String>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "enrollments", intValue: nil), CodingKeys(stringValue: "results", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "course", intValue: nil), CodingKeys(stringValue: "discussion_url", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))

HTTP Request

Request: GET https://blue.zeitlabs.com/api/mobile/v3/users/omarstudent/course_enrollments?page=1

{
  "configs": {
    "iap_configs": {}
  },
  "enrollments": {
    "next": null,
    "previous": null,
    "count": 2,
    "num_pages": 1,
    "current_page": 1,
    "start": 0,
    "results": [
      {
        "audit_access_expires": null,
        "created": "2024-02-29T12:51:54.025316Z",
        "mode": "audit",
        "is_active": true,
        "course": {
          "id": "course-v1:futurex+test101+2024",
          "name": "The Test Bank example course",
          "number": "test101",
          "org": "futurex",
          "start": "2020-01-01T00:00:00Z",
          "start_display": "Jan. 1, 2020",
          "start_type": "timestamp",
          "end": null,
          "dynamic_upgrade_deadline": null,
          "subscription_id": "course_MNXXK4TTMUWXMMJ2MZ2XI5LSMV4CW5DFON2DCMBRFMZDAMRU",
          "courseware_access": {
            "has_access": true,
            "error_code": null,
            "developer_message": null,
            "user_message": null,
            "additional_context_user_message": null,
            "user_fragment": null
          },
          "media": {
            "course_image": {
              "uri": "/asset-v1:futurex+test101+2024+type@asset+block@depositphotos_11930317-stock-photo-scantron-test-blocks-and-pencil.jpeg",
              "name": "Course Image"
            }
          },
          "course_image": "/asset-v1:futurex+test101+2024+type@asset+block@depositphotos_11930317-stock-photo-scantron-test-blocks-and-pencil.jpeg",
          "course_about": "https://blue.zeitlabs.com/courses/course-v1:futurex+test101+2024/about",
          "course_sharing_utm_parameters": {
            "facebook": "utm_medium=social&utm_campaign=social-sharing-db&utm_source=facebook",
            "twitter": "utm_medium=social&utm_campaign=social-sharing-db&utm_source=twitter"
          },
          "course_updates": "https://blue.zeitlabs.com/api/mobile/v3/course_info/course-v1:futurex+test101+2024/updates",
          "course_handouts": "https://blue.zeitlabs.com/api/mobile/v3/course_info/course-v1:futurex+test101+2024/handouts",
          "discussion_url": null,
          "video_outline": null,
          "is_self_paced": false
        },
        "certificate": {},
        "course_modes": [
          {
            "slug": "audit",
            "sku": null,
            "android_sku": null,
            "ios_sku": null,
            "min_price": 0
          }
        ]
      },
      {
        "audit_access_expires": null,
        "created": "2024-02-29T12:51:51.983028Z",
        "mode": "audit",
        "is_active": true,
        "course": {
          "id": "course-v1:i18n+i18n+i81n",
          "name": "Learn HTML the hard way",
          "number": "i18n",
          "org": "i18n",
          "start": "2030-01-01T00:00:00Z",
          "start_display": null,
          "start_type": "empty",
          "end": null,
          "dynamic_upgrade_deadline": null,
          "subscription_id": "course_MNXXK4TTMUWXMMJ2NEYTQ3RLNEYTQ3RLNE4DC3Q_",
          "courseware_access": {
            "has_access": false,
            "error_code": "course_not_started",
            "developer_message": "Course has not started",
            "user_message": "Course has not started",
            "additional_context_user_message": null,
            "user_fragment": null
          },
          "media": {
            "course_image": {
              "uri": "/asset-v1:i18n+i18n+i81n+type@asset+block@depositphotos_667560896-stock-photo-word-cloud-online-courses-concept.jpg",
              "name": "Course Image"
            }
          },
          "course_image": "/asset-v1:i18n+i18n+i81n+type@asset+block@depositphotos_667560896-stock-photo-word-cloud-online-courses-concept.jpg",
          "course_about": "https://blue.zeitlabs.com/courses/course-v1:i18n+i18n+i81n/about",
          "course_sharing_utm_parameters": {
            "facebook": "utm_medium=social&utm_campaign=social-sharing-db&utm_source=facebook",
            "twitter": "utm_medium=social&utm_campaign=social-sharing-db&utm_source=twitter"
          },
          "course_updates": "https://blue.zeitlabs.com/api/mobile/v3/course_info/course-v1:i18n+i18n+i81n/updates",
          "course_handouts": "https://blue.zeitlabs.com/api/mobile/v3/course_info/course-v1:i18n+i18n+i81n/handouts",
          "discussion_url": null,
          "video_outline": null,
          "is_self_paced": false
        },
        "certificate": {},
        "course_modes": [
          {
            "slug": "audit",
            "sku": null,
            "android_sku": null,
            "ios_sku": null,
            "min_price": 0
          }
        ]
      }
    ]
  }
}

Screenshot

image

Outcome

What did you expect?

See list of courses.

What happened instead?

I see empty list dashboard.

Your phone model

iPhone Simulator

Operating system version

iPhone 15 Pro simulator - iOS 17.2

Application version

develop branch (v1.0.0)

Activity

  1. linked a pull request that will close this issuefix: Dashboard parsing error #360on Mar 20, 2024
  2. gurhub commented on Mar 20, 2024

    @gurhub

    Hey @volodymyr-chekyrta, first of all, thanks for the solution and merge. After your solution, I manually got the raw Data_Dashboard.swift file content and tried it on my machine and I received another parsing error on Xcode's console:

    CodingKeys(stringValue: "start_display", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))

    By following your method, I was able to remove the start_display key from the Data_Dashboard.swift file. And run and test again. Now everything is working as expected.

    Best

  3. volodymyr-chekyrta commented on Mar 20, 2024

    @volodymyr-chekyrta
    Contributor

    @gurhub makes sense; the startDisplaying field is unused as well.
    I've updated PR ✅
    Thank you!

  4. gurhub commented on Mar 20, 2024

    @gurhub

    @volodymyr-chekyrta you're welcome!
    Best

  5. edschema commented on Oct 9, 2026

    @edschema
    Contributor

    fixed by #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions