Discussions

Ask a Question
Back to All

FormatException Input string was not in a correct format

Мы пользуемся Unity SDK. У нас в sentry падают много ошибок на iOS девайсах при попытке сделать double.Parse, что в итоге приводит к тому, что не можем получить Offerings. Вот логи:

Crashed in non-app:
System.Number.ParseDouble
QonversionUnity.Product..ctor
Called from:
System.Reflection.MonoCMethod.InternalInvoke
QonversionUnity.Mapper.ConvertObjectsList[T]
QonversionUnity.Offering..ctor
QonversionUnity.Offerings..ctor
QonversionUnity.Mapper.OfferingsFromJson
QonversionUnity.Qonversion.OnOfferings

Пришел такой Offering:

OnOfferings {"main":{"id":"avatar_scan","tag":1,"products":[{"storeProduct":{"subscriptionPeriod":{"numberOfUnits":1,"unit":2},"currencyCode":"EUR","downloadContentVersion":"","isFamilyShareable":false,"discounts":[],"subscriptionGroupIdentifier":"20926564","price":"21.49","productIdentifier":"monthly_subscription_ios","downloadContentLengths":[],"localeIdentifier":"nl_BE@currency=EUR","localizedDescription":"Monthly access to create your avatars","localizedTitle":"Monthly subscription","introductoryPrice":{"numberOfPeriods":0,"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"paymentMode":0,"type":0},"isDownloadable":false},"trialDuration":-1,"id":"monthly_subscription","duration":1,"type":1,"store_id":"monthly_subscription_ios","offeringId":"avatar_scan","prettyPrice":"€ 21,49"},{"storeProduct":{"subscriptionPeriod":{"numberOfUnits":1,"unit":3},"currencyCode":"EUR","downloadContentVersion":"","isFamilyShareable":false,"discounts":[],"subscriptionGroupIdentifier":"20926564","price":"214.99","productIdentifier":"annual_subscription_ios","downloadContentLengths":[],"localeIdentifier":"nl_BE@currency=EUR","localizedDescription":"Annual access to create your avatars","localizedTitle":"Annual subscription","introductoryPrice":{"numberOfPeriods":0,"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"paymentMode":0,"type":0},"isDownloadable":false},"trialDuration":-1,"id":"annual_subscription","duration":4,"type":1,"store_id":"annual_subscription_ios","offeringId":"avatar_scan","prettyPrice":"€ 214,99"}]},"availableOfferings":[{"id":"avatar_scan","tag":1,"products":[{"storeProduct":{"subscriptionPeriod":{"numberOfUnits":1,"unit":2},"currencyCode":"EUR","downloadContentVersion":"","isFamilyShareable":false,"discounts":[],"subscriptionGroupIdentifier":"20926564","price":"21.49","productIdentifier":"monthly_subscription_ios","downloadContentLengths":[],"localeIdentifier":"nl_BE@currency=EUR","localizedDescription":"Monthly access to create your avatars","localizedTitle":"Monthly subscription","introductoryPrice":{"numberOfPeriods":0,"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"paymentMode":0,"type":0},"isDownloadable":false},"trialDuration":-1,"id":"monthly_subscription","duration":1,"type":1,"store_id":"monthly_subscription_ios","offeringId":"avatar_scan","prettyPrice":"€ 21,49"},{"storeProduct":{"subscriptionPeriod":{"numberOfUnits":1,"unit":3},"currencyCode":"EUR","downloadContentVersion":"","isFamilyShareable":false,"discounts":[],"subscriptionGroupIdentifier":"20926564","price":"214.99","productIdentifier":"annual_subscription_ios","downloadContentLengths":[],"localeIdentifier":"nl_BE@currency=EUR","localizedDescription":"Annual access to create your avatars","localizedTitle":"Annual subscription","introductoryPrice":{"numberOfPeriods":0,"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"paymentMode":0,"type":0},"isDownloadable":false},"trialDuration":-1,"id":"annual_subscription","duration":4,"type":1,"store_id":"annual_subscription_ios","offeringId":"avatar_scan","prettyPrice":"€ 214,99"}]},{"id":"games_export","tag":0,"products":[{"storeProduct":{"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"currencyCode":"EUR","downloadContentVersion":"","isFamilyShareable":false,"discounts":[],"price":"9.99","productIdentifier":"gtav_export_ios","downloadContentLengths":[],"localeIdentifier":"nl_BE@currency=EUR","localizedDescription":"Export your avatar to GTA V PC","localizedTitle":"GTA V export","introductoryPrice":{"numberOfPeriods":0,"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"paymentMode":0,"type":0},"isDownloadable":false},"trialDuration":-1,"id":"gtav_export","duration":-1,"type":2,"store_id":"gtav_export_ios","offeringId":"games_export","prettyPrice":"€ 9,99"},{"storeProduct":{"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"currencyCode":"EUR","downloadContentVersion":"","isFamilyShareable":false,"discounts":[],"price":"9.99","productIdentifier":"vrchat_export_ios","downloadContentLengths":[],"localeIdentifier":"nl_BE@currency=EUR","localizedDescription":"Export your avatar to VRChat","localizedTitle":"VRChat Export","introductoryPrice":{"numberOfPeriods":0,"subscriptionPeriod":{"numberOfUnits":0,"unit":0},"paymentMode":0,"type":0},"isDownloadable":false},"trialDuration":-1,"id":"vrchat_export","duration":-1,"type":2,"store_id":"vrchat_export_ios","offeringId":"games_export","prettyPrice":"€ 9,99"}]}]}

Кажется можно пофиксить сконвертировав localeIdentifier в CultureInfo или FormatProvider и послав при парсе double