【发布时间】:2014-04-04 18:22:06
【问题描述】:
我目前遇到这个问题和这个错误:
问题:我无法弄清楚如何解决我遇到的错误,即使我在 Google 搜索等上阅读了有关它的文档。真的,不要再告诉我这样做了,我不知道不知道怎么做!
错误:异步方法的返回类型必须为 void,Task 或 Task
代码:
private async Geoposition userLocation() { Geolocator geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; try { Geoposition geoposition = await geolocator.GetGeopositionAsync(maximumAge:TimeSpan.FromMinutes(5),timeout:TimeSpan.FromSeconds(10)); return geoposition; } catch (UnauthorizedAccessException) { return null; } return null; }
【问题讨论】:
标签: c# windows-phone-8 asynchronous geolocation async-await