adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
95 stars 17 forks source link

Adapty.getPurchaserInfo(forceUpdate:true) returns no accessLevel when user first logs in from iOS #43

Closed lcuis closed 2 years ago

lcuis commented 2 years ago

Hi,

We get an astonishing behavior in the sandbox. When newly created app user logs in from Android, the Adapty.getPurchaserInfo(forceUpdate:true) returns a complete list of accessLevels. Then, the same app user on iOS, also gets the complete list of accessLevels. However, when the newly created app user first logs in from iOS, the same user gets an empty accessLevels using Adapty.getPurchaserInfo(forceUpdate:true) from iOS and Android.

Here is how we call Adapty.getPurchaserInfo( forceUpdate:true):

        AdaptyPurchaserInfo purchaserInfo = await Adapty.getPurchaserInfo( forceUpdate:true);

Here is how we call Adapty.identify(userId):

        result=await Adapty.identify(userId);

Here are our logs (edited to avoid sharing private information) with full Adapty verbosity when performing the identify and getPurchaseInfo (among other events) from iOS:

2022-03-03 20:38:57.996+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: logout(_:)
2022-03-03 20:38:57.996+0100 [Adapty v1.16.8(1)] - INFO.
Updating local purchaserInfo: nil, with profileId: nil, customerUserId: nil
2022-03-03 20:38:58.002+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: createProfile(_:_:)
2022-03-03 20:38:58.003+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: POST https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/
Params: ["data": ["id": "YYY", "type": "adapty_analytics_profile"]]
Headers: ["Authorization": "Api-Key public_live_XXX”, "ADAPTY-SDK-PLATFORM": "iOS", "Content-Type": "application/vnd.api+json", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PROFILE-ID": "YYY", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY_SDK_LOCALE": "en-CH"]
2022-03-03 20:38:58.347+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/
{"data":{"type":"adapty_analytics_profile","id":"YYY","attributes":{"app_id":"ZZZ","profile_id":"YYY","customer_user_id":null,"paid_access_levels":null,"subscriptions":null,"non_subscriptions":null,"promotional_offer_eligibility":false,"introductory_offer_eligibility":true,"custom_attributes":{}}}}
Headers: [AnyHashable("Date"): Thu, 03 Mar 2022 19:38:58 GMT, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("x-frame-options"): DENY, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("allow"): GET, POST, PATCH, HEAD, OPTIONS, AnyHashable("referrer-policy"): same-origin, AnyHashable("Via"): 1.1 google, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=aaa"}],"group":"cf-nel","max_age":604800}, AnyHashable("Server"): cloudflare, AnyHashable("Vary"): Origin, Accept-Encoding, AnyHashable("x-content-type-options"): nosniff, AnyHashable("cf-ray"): bbb-MAD]
2022-03-03 20:38:58.355+0100 [Adapty v1.16.8(1)] - INFO.
Updating local purchaserInfo: Optional(accessLevels: [:], subscriptions: [:], nonSubscriptions: [:]), with profileId: Optional("YYY"), customerUserId: nil
2022-03-03 20:38:58.356+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: syncInstallation(_:)
2022-03-03 20:38:58.362+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: POST https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/installation-metas/AAA/
Params: ["data": ["attributes": ["adapty_sdk_version": "1.16.8", "idfa": "00000000-0000-0000-0000-000000000000", "platform": "iOS", "app_build": "14", "device": "iPhone9,3", "idfv": "zzz", "os": "iOS 15.2.1", "app_version": "1.0.0", "locale": "en-CH", "adapty_sdk_version_build": 1, "timezone": "Africa/Casablanca"], "type": "adapty_analytics_profile_installation_meta", "id": "AAA"]]
Headers: ["ADAPTY_SDK_LOCALE": "en-CH", "ADAPTY-SDK-PLATFORM": "iOS", "Content-Type": "application/vnd.api+json", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PROFILE-ID": "YYY", "Authorization": "Api-Key public_live_XXX”]
2022-03-03 20:38:58.365+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: GET https://api.adapty.io/api/v1/sdk/in-apps/purchase-containers/?profile_id=YYY&paywall_padding_top=20.0&automatic_paywalls_screen_reporting_enabled=false
Params: ["profile_id": "YYY", "paywall_padding_top": 20.0, "automatic_paywalls_screen_reporting_enabled": false]
Headers: ["Content-Type": "application/x-www-form-urlencoded; charset=utf-8", "ADAPTY-SDK-PLATFORM": "iOS", "ADAPTY-SDK-PROFILE-ID": "YYY", "Authorization": "Api-Key public_live_XXX”, "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY_SDK_LOCALE": "en-CH"]
2022-03-03 20:38:58.365+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: syncTransactionsHistory()
2022-03-03 20:38:58.690+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/installation-metas/AAA/
{"data":{"type":"adapty_analytics_profile_installation_meta","id":"AAA","attributes":{"profile_id":"YYY","iam_access_key_id":"BBB","iam_secret_key":"LLL","iam_session_token":"DDD","iam_expiration":"2022-03-03T20:38:58Z"}}}
Headers: [AnyHashable("Date"): Thu, 03 Mar 2022 19:38:58 GMT, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("Vary"): Origin, Accept-Encoding, AnyHashable("x-frame-options"): DENY, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("referrer-policy"): same-origin, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("Server"): cloudflare, AnyHashable("cf-ray"): VVV-MAD, AnyHashable("x-content-type-options"): nosniff, AnyHashable("Via"): 1.1 google, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=EEE"}],"group":"cf-nel","max_age":604800}, AnyHashable("allow"): POST, OPTIONS]
2022-03-03 20:38:58.697+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: POST https://kinesis.us-east-1.amazonaws.com
Params: ["Records": [["PartitionKey": "AAA", "Data": "CCC"]], "StreamName": "adapty-data-pipeline-prod"]
Headers: ["Content-Type": "application/vnd.api+json"]
2022-03-03 20:38:59.007+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/in-apps/purchase-containers/?profile_id=YYY&paywall_padding_top=20.0&automatic_paywalls_screen_reporting_enabled=false
{"data":[{"type":"adapty_inapps_purchase_container_compact","id":"TTT","attributes":{"developer_id":"bp_plus","revision":5,"variation_id":"UUU","ab_test_name":"FFF Plus","paywall_name":"FFF Plus","products":[{"title":"FFF Plus - Annual","vendor_product_id":"bp_1Y_4999_0w0","promotional_offer_id":null,"introductory_offer_eligibility":true,"promotional_offer_eligibility":false},{"title":"FFF Plus - Monthly","vendor_product_id":"bp_1M_699_0w0","promotional_offer_id":null,"introductory_offer_eligibility":true,"promotional_offer_eligibility":false}],"is_promo":false,"visual_paywall":null,"custom_payload":null}}],"meta":{"products":[{"title":"FFF Plus - Annual","vendor_product_id":"bp_1Y_4999_0w0","introductory_offer_eligibility":true,"promotional_offer_eligibility":false},{"title":"FFF Plus - Monthly","vendor_product_id":"bp_1M_699_0w0","introductory_offer_eligibility":true,"promotional_offer_eligibility":false}]}}
Headers: [AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("Content-Encoding"): br, AnyHashable("x-response-from-cache"): False, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("x-content-type-options"): nosniff, AnyHashable("referrer-policy"): same-origin, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=WWW"}],"group":"cf-nel","max_age":604800}, AnyHashable("x-frame-options"): DENY, AnyHashable("Date"): Thu, 03 Mar 2022 19:38:59 GMT, AnyHashable("Server"): cloudflare, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("Via"): 1.1 google, AnyHashable("Vary"): Origin, Accept-Encoding, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("allow"): GET, HEAD, OPTIONS, AnyHashable("cf-ray"): xxx-MAD, AnyHashable("x-response-hash"): yyy]
2022-03-03 20:38:59.854+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://kinesis.us-east-1.amazonaws.com/
{"FailedRecordCount":0,"Records":[{"SequenceNumber":"RRR","ShardId":"shardId-000000000004"}]}
Headers: [AnyHashable("x-amz-id-2"): SSS, AnyHashable("Date"): Thu, 03 Mar 2022 19:38:59 GMT, AnyHashable("Content-Type"): application/x-amz-json-1.1, AnyHashable("x-amzn-RequestId"): c481b40d-2e30-db4e-9e1a-af9ec38335e9, AnyHashable("Content-Length"): 146]
2022-03-03 20:39:00.202+0100 [Adapty v1.16.8(1)] - INFO.
Found product: bp_1M_699_0w0 FFF Plus - Monthly 6.99
2022-03-03 20:39:00.202+0100 [Adapty v1.16.8(1)] - INFO.
Found product: bp_1Y_4999_0w0 FFF Plus - Annual 49.99
2022-03-03 20:39:00.207+0100 [Adapty v1.16.8(1)] - INFO.
Successfully loaded list of products: [bp_1Y_4999_0w0,bp_1M_699_0w0]
2022-03-03 20:39:00.207+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: getPromo(_:)
2022-03-03 20:39:00.207+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: GET https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/promo/
Params: [:]
Headers: ["Authorization": "Api-Key public_live_XXX”, "ADAPTY-SDK-PLATFORM": "iOS", "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PROFILE-ID": "YYY", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY_SDK_LOCALE": "en-CH"]
2022-03-03 20:39:00.350+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: identify(_:completion:)
2022-03-03 20:39:00.350+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: createProfile(_:_:)
2022-03-03 20:39:00.351+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: POST https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/
Params: ["data": ["id": "YYY", "type": "adapty_analytics_profile", "attributes": ["customer_user_id": "603"]]]
Headers: ["ADAPTY_SDK_LOCALE": "en-CH", "ADAPTY-SDK-PLATFORM": "iOS", "Content-Type": "application/vnd.api+json", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PROFILE-ID": "YYY", "Authorization": "Api-Key public_live_XXX”]
2022-03-03 20:39:00.444+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/promo/
{"data":{}}
Headers: [AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=PPP"}],"group":"cf-nel","max_age":604800}, AnyHashable("Server"): cloudflare, AnyHashable("Vary"): Origin, AnyHashable("Content-Length"): 11, AnyHashable("allow"): GET, HEAD, OPTIONS, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("x-content-type-options"): nosniff, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("x-frame-options"): DENY, AnyHashable("cf-ray"): 6e64d5ef5ce169d0-MAD, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("referrer-policy"): same-origin, AnyHashable("Via"): 1.1 google, AnyHashable("Date"): Thu, 03 Mar 2022 19:39:00 GMT]
2022-03-03 20:39:00.752+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/
{"data":{"type":"adapty_analytics_profile","id":"YYY","attributes":{"app_id":"ZZZ","profile_id":"YYY","customer_user_id":"603","paid_access_levels":null,"subscriptions":null,"non_subscriptions":null,"promotional_offer_eligibility":false,"introductory_offer_eligibility":true,"custom_attributes":{}}}}
Headers: [AnyHashable("Via"): 1.1 google, AnyHashable("x-content-type-options"): nosniff, AnyHashable("cf-ray"): 6e64d5f0df3a69d0-MAD, AnyHashable("referrer-policy"): same-origin, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("x-frame-options"): DENY, AnyHashable("Vary"): Origin, Accept-Encoding, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("allow"): GET, POST, PATCH, HEAD, OPTIONS, AnyHashable("Date"): Thu, 03 Mar 2022 19:39:00 GMT, AnyHashable("Content-Encoding"): br, AnyHashable("Server"): cloudflare, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=QQQ"}],"group":"cf-nel","max_age":604800}]
2022-03-03 20:39:00.754+0100 [Adapty v1.16.8(1)] - INFO.
Updating local purchaserInfo: Optional(accessLevels: [:], subscriptions: [:], nonSubscriptions: [:]), with profileId: Optional("YYY"), customerUserId: Optional("603")
2022-03-03 20:39:00.755+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: syncInstallation(_:)
2022-03-03 20:39:00.758+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: POST https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/installation-metas/AAA/
Params: ["data": ["id": "AAA", "type": "adapty_analytics_profile_installation_meta"]]
Headers: ["ADAPTY_SDK_LOCALE": "en-CH", "ADAPTY-SDK-PLATFORM": "iOS", "Content-Type": "application/vnd.api+json", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PROFILE-ID": "YYY", "Authorization": "Api-Key public_live_MMM"]
2022-03-03 20:39:00.759+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: GET https://api.adapty.io/api/v1/sdk/in-apps/purchase-containers/?profile_id=YYY&automatic_paywalls_screen_reporting_enabled=false&paywall_padding_top=20.0
Params: ["profile_id": "YYY", "automatic_paywalls_screen_reporting_enabled": false, "paywall_padding_top": 20.0]
Headers: ["ADAPTY-SDK-PREVIOUS-RESPONSE-HASH": "yyy", "ADAPTY_SDK_LOCALE": "en-CH", "ADAPTY-SDK-PLATFORM": "iOS", "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PROFILE-ID": "YYY", "Authorization": "Api-Key public_live_MMM"]
2022-03-03 20:39:00.759+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: syncTransactionsHistory()
2022-03-03 20:39:00.800+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: getPurchaserInfo(forceUpdate:_:)
2022-03-03 20:39:00.800+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: GET https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/
Params: [:]
Headers: ["ADAPTY-SDK-PROFILE-ID": "YYY", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-PLATFORM": "iOS", "ADAPTY_SDK_LOCALE": "en-CH", "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", "Authorization": "Api-Key public_live_MMM"]
2022-03-03 20:39:01.020+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/installation-metas/AAA/
{"data":{"type":"adapty_analytics_profile_installation_meta","id":"AAA","attributes":{"profile_id":"YYY","iam_access_key_id":"BBB","iam_secret_key":"LLL","iam_session_token":"DDD","iam_expiration":"2022-03-03T20:38:58Z"}}}
Headers: [AnyHashable("Vary"): Origin, Accept-Encoding, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("x-content-type-options"): nosniff, AnyHashable("allow"): POST, OPTIONS, AnyHashable("Content-Encoding"): br, AnyHashable("referrer-policy"): same-origin, AnyHashable("cf-ray"): NNN-MAD, AnyHashable("Date"): Thu, 03 Mar 2022 19:39:01 GMT, AnyHashable("Via"): 1.1 google, AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OOO"}],"group":"cf-nel","max_age":604800}, AnyHashable("Server"): cloudflare, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("x-frame-options"): DENY, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400]
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
2022-03-03 20:39:01.325+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/in-apps/purchase-containers/?profile_id=YYY&automatic_paywalls_screen_reporting_enabled=false&paywall_padding_top=20.0
{"data":{}}
Headers: [AnyHashable("x-content-type-options"): nosniff, AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=KKK"}],"group":"cf-nel","max_age":604800}, AnyHashable("Server"): cloudflare, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("Date"): Thu, 03 Mar 2022 19:39:01 GMT, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("x-response-from-cache"): False, AnyHashable("Vary"): Origin, AnyHashable("Content-Length"): 11, AnyHashable("Via"): 1.1 google, AnyHashable("cf-ray"): 6e64d5f4bde169d0-MAD, AnyHashable("referrer-policy"): same-origin, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("x-frame-options"): DENY, AnyHashable("allow"): GET, HEAD, OPTIONS, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("x-response-hash"): yyy]
2022-03-03 20:39:01.409+0100 [Adapty v1.16.8(1)] - INFO.
Found product: bp_1M_699_0w0 FFF Plus - Monthly 6.99
2022-03-03 20:39:01.409+0100 [Adapty v1.16.8(1)] - INFO.
Found product: bp_1Y_4999_0w0 FFF Plus - Annual 49.99
2022-03-03 20:39:01.411+0100 [Adapty v1.16.8(1)] - INFO.
Successfully loaded list of products: [bp_1Y_4999_0w0,bp_1M_699_0w0]
2022-03-03 20:39:01.411+0100 [Adapty v1.16.8(1)] - INFO.
Calling now: getPromo(_:)
2022-03-03 20:39:01.412+0100 [Adapty v1.16.8(1)] - INFO.
Starting new request: GET https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/promo/
Params: [:]
Headers: ["Authorization": "Api-Key public_live_MMM", "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", "ADAPTY_SDK_LOCALE": "en-CH", "ADAPTY-SDK-VERSION": "1.16.8", "ADAPTY-SDK-VERSION-BUILD": "1", "ADAPTY-SDK-PLATFORM": "iOS", "ADAPTY-SDK-PROFILE-ID": "YYY"]
2022-03-03 20:39:01.682+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/
{"data":{"type":"adapty_analytics_profile","id":"YYY","attributes":{"app_id":"ZZZ","profile_id":"YYY","customer_user_id":"603","paid_access_levels":null,"subscriptions":null,"non_subscriptions":null,"promotional_offer_eligibility":false,"introductory_offer_eligibility":true,"custom_attributes":{}}}}
Headers: [AnyHashable("x-content-type-options"): nosniff, AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=III"}],"group":"cf-nel","max_age":604800}, AnyHashable("Server"): cloudflare, AnyHashable("Date"): Thu, 03 Mar 2022 19:39:01 GMT, AnyHashable("Content-Encoding"): br, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("x-response-from-cache"): False, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("Vary"): Origin, Accept-Encoding, AnyHashable("Via"): 1.1 google, AnyHashable("cf-ray"): JJJ-MAD, AnyHashable("referrer-policy"): same-origin, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("x-frame-options"): DENY, AnyHashable("allow"): GET, POST, PATCH, HEAD, OPTIONS, AnyHashable("Content-Type"): application/vnd.api+json, AnyHashable("x-response-hash"): 14f856b3b5c9bf63]
2022-03-03 20:39:01.695+0100 [Adapty v1.16.8(1)] - INFO.
Updating local purchaserInfo: Optional(accessLevels: [:], subscriptions: [:], nonSubscriptions: [:]), with profileId: Optional("YYY"), customerUserId: Optional("603")
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The getter 'isActive' was called on null.
Receiver: null
Tried calling: isActive
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:63:5)
#1      PurchaseManager.getSubscription (package:FFF/management/purchaseManager.dart:125:50)
<asynchronous suspension>
#2      PurchaseManager.logIn (package:FFF/management/purchaseManager.dart:52:7)
<asynchronous suspension>
2022-03-03 20:39:02.457+0100 [Adapty v1.16.8(1)] - INFO.
Received response: https://api.adapty.io/api/v1/sdk/analytics/profiles/YYY/promo/
{"data":{}}
Headers: [AnyHashable("x-frame-options"): DENY, AnyHashable("expect-ct"): max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", AnyHashable("cf-ray"): GGG-MAD, AnyHashable("x-content-type-options"): nosniff, AnyHashable("Content-Length"): 11, AnyHashable("Server"): cloudflare, AnyHashable("report-to"): {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=HHH"}],"group":"cf-nel","max_age":604800}, AnyHashable("allow"): GET, HEAD, OPTIONS, AnyHashable("Via"): 1.1 google, AnyHashable("referrer-policy"): same-origin, AnyHashable("cf-cache-status"): DYNAMIC, AnyHashable("nel"): {"success_fraction":0,"report_to":"cf-nel","max_age":604800}, AnyHashable("Date"): Thu, 03 Mar 2022 19:39:02 GMT, AnyHashable("Alt-Svc"): h3=":443"; ma=86400, h3-29=":443"; ma=86400, AnyHashable("Vary"): Origin, AnyHashable("Content-Type"): application/vnd.api+json]

We looked at reasons for this inconsistent behavior within our app and our server. So far, we do not have any hunch.

Is there any potential reason for this from an Adapty perspective?

lcuis commented 2 years ago

Hello,

Our issue was due to a misunderstanding of what Adapty.getPurchaserInfo(forceUpdate:true) is meant to be doing.

Sorry for the inconvenience.

OlegGrizzly commented 2 years ago

Hello,

Our issue was due to a misunderstanding of what Adapty.getPurchaserInfo(forceUpdate:true) is meant to be doing.

Sorry for the inconvenience.

Hi! I have the same problem :(What is your solution? How do you check the subscription status when you log in to the app?

lcuis commented 2 years ago

Hello @OlegGrizzly ,

I went through my code history from that time. Unfortunately, there were lots of changes. However, regarding getPurchaserInfo specifically, there were not that many. I set forceUpdate to false. I check that the returned AdaptyPurchaserInfo accessLevels is not null and not empty before accessing the values.

I believe that at the time, going through this page helped me: https://docs.adapty.io/docs/ios-subscription-status

I wish you luck with this issue @OlegGrizzly !