###前提・実現したいこと
Swift
1Painter Z index: 4294967291 is too large (max 255)
上記の警告?が発生しないようにしたい。
・住所から経度緯度を取得する形をとっています。
###発生している問題・エラーメッセージ
エラー自体は発生していないが、上記のメッセージが出る。
###該当のソースコード
Swift
1import UIKit 2import MapKit 3 4class ViewController: UIViewController, MKMapViewDelegate { 5 6 @IBOutlet weak var mapView: MKMapView! 7 8 let dataGroup: [[String: AnyObject?]] = [["address": "東京都渋谷区道玄坂2丁目", "name": "テスト"]] 9 10 override func viewDidLoad() { 11 super.viewDidLoad() 12 dropPin() 13 } 14 15 func dropPin() { 16 17 if self.dataGroup.count != 0 { 18 for num in 0...self.dataGroup.count - 1 { 19 let myAddress: String = (self.dataGroup[num]["address"] as? String)! 20 let myGeocoder = CLGeocoder() 21 myGeocoder.geocodeAddressString(myAddress, completionHandler: { (placemarks, error) -> Void in 22 for placemark in placemarks! { 23 let location: CLLocation = placemark.location! 24 let annotation = MapAnnotationSetting() 25 26 annotation.coordinate = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude) 27 annotation.title = self.dataGroup[num]["name"] as? String 28 annotation.subtitle = self.dataGroup[num]["address"] as? String 29 self.mapView.addAnnotation(annotation) 30 31 self.mapView.showAnnotations(self.mapView.annotations, animated: true) 32 33 } 34 }) 35 } 36 } 37 38 } 39 40} 41
###補足情報(言語/FW/ツール等のバージョンなど)
・Xcode7.3.1
・Swift2
どなたかご回答よろしくお願いいたします。
###追記
どうやらある一定以上ズームしたら表示されるみたいですが、
なんの警告なのでしょうか。
###追記2
Swift
1myGeocoder.geocodeAddressString(myAddress, completionHandler: { (placemarks, error) -> Void in 2 for placemark in placemarks! { 3 let location: CLLocation = placemark.location! 4 let annotation = MapAnnotationSetting() 5 6 annotation.coordinate = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude) 7 annotation.title = self.dataGroup[num]["name"] as? String 8 annotation.subtitle = self.dataGroup[num]["address"] as? String 9 self.mapView.addAnnotation(annotation) 10 } 11 self.mapView.showAnnotations(self.mapView.annotations, animated: true) 12 })
###追記3
参考にしたサイトを元にここまで絞りましたがまだ警告が出ます。
Swift
1func dropPin() { 2 3 let myGeocoder:CLGeocoder = CLGeocoder() 4 let myAddress: String = (self.dataGroup[0]["address"] as? String)! 5 6 myGeocoder.geocodeAddressString(myAddress, completionHandler: {(placemarks, error) in 7 8 if(error == nil) { 9 for placemark in placemarks! { 10 let location:CLLocation = placemark.location! 11 let annotation = MKPointAnnotation() 12 annotation.coordinate = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude) 13 self.mapView.addAnnotation(annotation) 14 } 15 } 16 }) 17}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/09/09 02:27
2016/09/09 02:36
2016/09/09 02:41
2016/09/09 02:46
2016/09/09 02:48
2016/09/09 03:11
2016/09/09 04:44
2016/09/09 05:25
2016/09/09 05:36
2016/09/09 05:46