我想func adjustmentBestSongBpmHeartRate() 每1.1秒调用一次方法.我用过Timer,但它不起作用.我已阅读该文档并发现了大量示例代码,它仍然可以正常工作!我错过了什么吗?
timer = Timer.scheduledTimer(timeInterval: 1.1, target: self, selector: #selector(self.adjustmentBestSongBpmHeartRate), userInfo: nil, repeats: false)
timer.fire()
func adjustmentBestSongBpmHeartRate() {
print("frr")
}
Run Code Online (Sandbox Code Playgroud) 我只是在玩 Alamofire 框架并进行很少的 api 调用。但是我观察到 alamofire 中有两种请求方法
Alamofire 的 responseJSON 和 responseData 有什么区别。
public func responseData(
queue: DispatchQueue? = nil,
completionHandler: @escaping (DataResponse<Data>) -> Void)
-> Self
{
return response(
queue: queue,
responseSerializer: DataRequest.dataResponseSerializer(),
completionHandler: completionHandler
)
}
public func responseJSON(
queue: DispatchQueue? = nil,
options: JSONSerialization.ReadingOptions = .allowFragments,
completionHandler: @escaping (DataResponse<Any>) -> Void)
-> Self
{
return response(
queue: queue,
responseSerializer: DataRequest.jsonResponseSerializer(options: options),
completionHandler: completionHandler
)
}
Run Code Online (Sandbox Code Playgroud) 我尝试在我的项目中使用RxSwift.我的podfile如下所示,↓
我收到了这个错误:
这是我的Link Binary With Libraries状态:
我试过修复它超过三个小时.但网站上的答案对我不起作用......