gpt4 book ai didi

ios - 如何在定时器选择器上传递参数

转载 作者:搜寻专家 更新时间:2023-10-31 22:05:06 24 4
gpt4 key购买 nike

<分区>

  func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let mostRecentLocation = locations.last else {
return
}

print(mostRecentLocation.coordinate.latitude)
print(mostRecentLocation.coordinate.longitude)
Timer.scheduledTimer(timeInterval: 60.0, target: self, selector: #selector(StartTestVC.sendDataToServer), userInfo: nil, repeats: true)
}

func sendDataToServer (latitude: Double, longitude: Double) {
SFUserManager.shared.uploadPULocation(latitude, longitude:longitude)
}

我想每 1 分钟向服务器发送一次数据。我正在使用 Timer.scheduledTimer 并设置选择器。但是我怎样才能将 lat/lng 参数发送到我的函数呢?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com