MKAnnotationView层不是预期的types:MKLayer

所以我的代码工作正常,但我的logging器充满了这个消息。 有没有办法摆脱它或压制它?

PostAnnotation.swift

class PostAnnotation: MKPointAnnotation { //MARK: properties let post: Post //MARK: initialization init(post: Post) { self.post = post super.init() self.coordinate = CLLocationCoordinate2D(latitude: post.latitude, longitude: post.longitude) self.title = post.title self.subtitle = post.timeString() } } 

添加注释

 let annotation = PostAnnotation(post: post) self.map.addAnnotation(annotation) 

func mapView

 func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { if annotation is MKUserLocation { return nil } var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "pin") as? MKPinAnnotationView if annotationView == nil { annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin") } else { annotationView?.annotation = annotation } if let annotation = annotation as? PostAnnotation { annotationView?.pinTintColor = UIColor.blue annotationView?.canShowCallout = true annotationView?.rightCalloutAccessoryView = UIButton(type: .infoLight) annotationView?.animatesDrop = true } return annotationView } 

删除此function将删除该消息

这是iOS 11中的一个错误,因为MKLayer不是公共类。

我只是简单地忽略这个消息,但是如果它困扰你:为了OS_ACTIVITY_MODE=disable这个警告,你可以在scheme的环境页面中设置OS_ACTIVITY_MODE=disable 。 但是要小心,你也会沉默其他操作系统的警告。

计划编辑器