AvdLee / appstoreconnect-swift-sdk

The Swift SDK to work with the App Store Connect API from Apple.
Other
1.48k stars 198 forks source link

Requesting appStoreVersionPhasedRelease returns nil data for version 1.0, which results in a decoding failure #263

Closed acecilia closed 3 months ago

acecilia commented 8 months ago

šŸ‘‹

Hi. I experienced that the following code:

let request = APIEndpoint.v1.appStoreVersions.id(version.id).appStoreVersionPhasedRelease.get(
    fieldsAppStoreVersionPhasedReleases: [.startDate]
)
let response = try await apiProvider.request(request)

Fails decoding the response and throws the following error:

Error: Failed to decode response:
{
  "data" : null,
  "links" : {
    "self" : "https://api.appstoreconnect.apple.com/v1/appStoreVersions/<redacted id>/appStoreVersionPhasedRelease?fields%5BappStoreVersionPhasedReleases%5D=startDate
  }
}
Error: valueNotFound(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: [StringCodingKey(stringValue: "data", intValue: nil)], debugDescription: "Cannot get keyed decoding container -- found null value instead", underlyingError: nil)).

I believe is happening because the version-id I am requesting corresponds to a version 1.0, meaning is the first time the app is being distributed, so doing phase release is impossible. Looks like appstoreconnect API communicates this by returning "data" : null, which is unexpected to the SDK that is trying to decode a non-null data property.

I am using version 2.3.0 of the SDK, but I believe the issue should also be present in latest version 3.X, as the struct used for decoding which is here has not been changed in the past 2 years.

J0s34h commented 7 months ago

Having the same issue with - AppStoreVersionPhasedReleaseWithoutIncludesResponse, latest version

J0s34h commented 7 months ago

You might want to look at following merge request - https://github.com/AvdLee/appstoreconnect-swift-sdk/pull/271

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

acecilia commented 6 months ago

Still an issue

caka1011 commented 6 months ago

Hello. Can anyone share the code to fetch the last version submitted to the app store? Thanks

polpielladev commented 5 months ago

Hi @acecilia, sorry for the delay on this, I will make an action on my side to check this and get back to you tomorrow evening šŸ‘

polpielladev commented 5 months ago

Hi! @acecilia, we're in the process of updating to the latest schema as part of https://github.com/AvdLee/appstoreconnect-swift-sdk/pull/276. This PR includes fixes to the decoding of this endpoint. Could you confirm if the work on that branch fixes your problem?

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.