You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS调用hyperTrackViews.subscribeToMovementStatusUpdates查询MovementStatus失败

iOS调用hyperTrackViews.subscribeToMovementStatusUpdates报错'HyperTrackViews failed to query MovementStatus'排查方案

调用hyperTrackViews.subscribeToMovementStatusUpdates订阅设备MovementStatus更新时,触发错误回调,提示HyperTrackViews failed to query MovementStatus,相关代码如下:

cancelSubscription = hyperTrackViews.subscribeToMovementStatusUpdates(for: deviceIDhtk) { [weak self] result in
    guard let self = self else { return }
    
    print("hptmovementResultSubs::", result)
    
    switch result {
    case let .success(movementStatus):
        print("hptmovementStatusSubs::", movementStatus)
        if let trip = movementStatus.trips.first {
            print("hptmovementStatusTrip",movementStatus.trips)
        } else {
            print("hptmovementStatusTripElse",movementStatus.trips)
        }
        
    case .failure(let error):
        dump(error)
        print("hptmovementStatusSubsError::",error)
    }
}

排查与解决步骤

  • 验证设备ID有效性
    确认传入的deviceIDhtk是HyperTrack平台已注册的有效设备ID,避免空值、格式错误或未关联的ID。可在HyperTrack控制台核对设备列表,确保ID完全匹配。

  • 检查SDK初始化状态
    确保HyperTrack SDK已用正确的Publishable Key完成初始化,未初始化或密钥错误会导致所有API请求失败。初始化示例:

    HyperTrack.initialize(publishableKey: "YOUR_PUBLISHABLE_KEY")
    
  • 确认网络权限与连接
    该接口依赖网络请求获取状态,检查设备是否有网络连接,且App已获取蜂窝数据/无线局域网权限。可切换网络环境测试。

  • 检查设备追踪状态
    目标设备需处于活跃追踪状态,若设备未激活或已停止追踪,会导致查询失败。在HyperTrack控制台查看对应设备的追踪状态,确保设备在线且追踪功能正常。

  • 提取详细错误信息
    利用dump(error)查看错误完整堆栈,或获取error.localizedDescription、error.code属性,定位具体失败原因(如权限不足、API限制、设备不存在等)。

  • 更新SDK版本
    确保使用HyperTrack iOS SDK最新稳定版本,旧版本可能存在已知API调用bug。通过CocoaPods更新:

    pod update HyperTrack
    

内容的提问来源于stack exchange,提问作者Sourav Chakraborty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 12:05:28