Skip to content

iOS 端获取广告时长, 解决 iOS 中 广告加载时长 int.tryParse 解析数据失败 #349

@sshixiaofeng1211-source

Description

MAX Plugin Version

13.5.0

Flutter Version

4.6.0

Device/Platform Info

iPhone iOS 25

Current Behavior

解决 iOS 中 广告加载时长 (NSTimeInterval requestLatency ) 由于精度原因导致flutter 通过 int.tryParse 解析数据失败的问题

位置:
lib/src/ad_classes.dart

问题位置
flutter 侧 tryParse(json['latencyMillis']?.toString() ?? '0.0') 会失败

解决方案
(double.tryParse(json['latencyMillis']?.toString() ?? '0.0') ?? 0.0).toInt(),

Expected Behavior

位置:
lib/src/ad_classes.dart

问题位置
flutter 侧 tryParse(json['latencyMillis']?.toString() ?? '0.0') 会失败

解决方案
(double.tryParse(json['latencyMillis']?.toString() ?? '0.0') ?? 0.0).toInt(),

How to Reproduce

位置:
lib/src/ad_classes.dart

问题位置
flutter 侧 tryParse(json['latencyMillis']?.toString() ?? '0.0') 会失败

解决方案
(double.tryParse(json['latencyMillis']?.toString() ?? '0.0') ?? 0.0).toInt(),

Reproducible in the demo app?

Yes

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions