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

_TypeError - Battery Level - iOS 16.4 #1432

Closed
PaoloTolentino opened this issue May 10, 2023 · 6 comments · Fixed by #1433
Closed

_TypeError - Battery Level - iOS 16.4 #1432

PaoloTolentino opened this issue May 10, 2023 · 6 comments · Fixed by #1433

Comments

@PaoloTolentino
Copy link

PaoloTolentino commented May 10, 2023

Platform

Dart

Obfuscation

Enabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.7.12, on macOS 13.2.1 22D68 darwin-arm64, locale en-PH)
• Flutter version 3.7.12 on channel stable at /Users/solstella/fvm/versions/stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4d9e56e694 (3 weeks ago), 2023-04-17 21:47:46 -0400
• Engine revision 1a65d409c7
• Dart version 2.19.6
• DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/solstella/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.12.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.79.0-insider)
• VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
• Flutter extension version 3.63.20230303

[✓] Connected device (3 available)
• iPhone (2) (mobile) • ef913248aabd81890dd7e6787045ddfa9b1f08f3 • ios • iOS 16.4.1 20E252
• macOS (desktop) • macos • darwin-arm64 • macOS 13.2.1 22D68 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

Version

7.5.2

Steps to Reproduce

  1. Setup Sentry
  2. Run normally and start capturing exceptions

Expected Result

There should be no exceptions in parsing SentryDevice. Especially the batteryLevel

Actual Result

2023-05-10 13:24:09.867025+0800 Enstack Beta[4444:354698] [Sentry] [debug] [SentryFileManager:423] Writing to file: /var/mobile/Containers/Data/Application/782968EC-446B-42E8-A5DA-7E56BE461125/Library/Caches/io.sentry/98bd54bd3f1d2068e656ac1f0a7b6ee840a12f4f/envelopes/1683696249.866968-00091-9ADA1973-12C7-4443-B82A-BC1E71551F4F.json
[sentry] _TypeError (type 'int' is not a subtype of type 'double?')
[sentry] #0      new SentryDevice.fromJson
sentry_device.dart:181
#1      new Contexts.fromJson
contexts.dart:38
#2      _LoadContextsIntegrationEventProcessor.apply
load_contexts_integration.dart:51
#3      SentryClient._runEventProcessors
sentry_client.dart:416
#4      SentryClient.captureEvent
sentry_client.dart:90
#5      Hub.captureMessage

Are you willing to submit a PR?

None

@ueman
Copy link
Collaborator

ueman commented May 10, 2023

Seems like

batteryLevel: data['battery_level'],

should be

        batteryLevel: (data['battery_level'] as num)?.toInt(),

@marandaneto
Copy link
Contributor

batteryLevel is a double?, so probably not parsing to toInt, we'd lose the precision if its a double.

@marandaneto
Copy link
Contributor

@ueman maybe batteryLevel: (data['battery_level'] as num?)?.toDouble(),.

@kuhnroyal
Copy link
Contributor

Can we somehow get this fix without all the other changes as a 7.5.3?

@marandaneto
Copy link
Contributor

Can we somehow get this fix without all the other changes as a 7.5.3?

Is there a reason why not go to 7.6.x?

https://github.com/getsentry/sentry-dart/releases/tag/7.6.1
All the breaking changes are back-compatible anyway.

@kuhnroyal
Copy link
Contributor

Yea, I just saw the namespace change had a guard, so it should be fine. Thanks!

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

Successfully merging a pull request may close this issue.

4 participants