Created
January 9, 2019 04:15
-
-
Save ysam12345/ff963cb78798a0cbfa16538065268eba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func loadNotificationList() { | |
let url = URL(string: "http://140.121.197.197:3000/getUserNotificationList?facebook_token="+userData!.facebookAccessToken)! | |
let task = URLSession.shared.dataTask(with: url) { (data, response , error) in | |
let decoder = JSONDecoder() | |
decoder.dateDecodingStrategy = .iso8601 | |
if let data = data, let results = try? | |
decoder.decode(NotificationListData.self, from: data) | |
{ | |
print("json load success") | |
print(results) | |
self.mapView.removeAnnotations(self.mapView.annotations) | |
self.mapView.removeOverlays(self.mapView.overlays) | |
self.notificationListData = results | |
for var i in results.data { | |
self.addPointAndCircleToMapView(lat: i.data.lat, lon: i.data.lon, radius: i.data.radius, content: i.data.content) | |
} | |
} else { | |
print("error") | |
} | |
} | |
task.resume() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment