"'MKMapRectGetWidth' has been replaced by property 'MKMapRect.width" 在 Swift 5.0 中



我正在使用Apple的足迹:具有核心位置的室内定位示例代码来构建移动应用程序。这段代码是 Swift 3.0 的,我正在将其转换为 Swift 5.0 语法。当我运行这个 Swift 3.0 代码时,

 let mapkitFloorplanWidth = MKMapRectGetWidth(overlay.boundingMapRect)

我收到此错误。

"MKMapRectGetWidth"已被属性"MKMapRect.width"取代">

当我将语法更改为

let mapkitFloorplanWidth = MKMapRect(overlay.boundingMapRect.width)

我收到此错误消息

"无法使用类型为'(双精度('的参数列表调用类型'MKMapRect'的初始值设定项">

请帮助我了解如何运行这行代码?

您只需将MKMapRectGetWidth的使用替换为width的使用。

let mapkitFloorplanWidth = overlay.boundingMapRect.width

最新更新