当我将应用程序提交到商店时,任何人都知道为什么我的代码会出现错误。开发设备上的一切都运行良好。应用程序功能:LOCATION,MAP,IDENTITY_DEVICE,IDENTITY_USER,CAMERA,AUDIO,PHOTO,NETWORKING,PROXIMITY,PUSH_NOTIFICATION,SENSORS
private readonly Geolocator _geolocator = new Geolocator { DesiredAccuracy = PositionAccuracy.Default, MovementThreshold = 100 };
private async Task GetCurrentPosition()
{
//Get current location
try
{
_done.WaitOne();
var position = await _geolocator.GetGeopositionAsync();
if (position != null)
{
// Get detail address
var query = new ReverseGeocodeQuery { GeoCoordinate = new GeoCoordinate(position.Coordinate.Latitude, position.Coordinate.Longitude) };
query.QueryCompleted += OnQueryCompleted;
_done.Reset();
query.QueryAsync();
}
}
catch (Exception ex)
{
if (ex.Message.Contains("Operation aborted"))
{
if (MessageBox.Show(AppResources.LocationServiceErrorMsg, AppResources.ApplicationTitle, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));
Application.Current.Terminate();
}
else
{
Application.Current.Terminate();
}
}
}
}
private void OnQueryCompleted(object sender, QueryCompletedEventArgs<System.Collections.Generic.IList<MapLocation>> e)
{
_done.Set();
if (e.Result != null && e.Result.Count > 0)
{
App.AppData.CurrentCountry = e.Result[0].Information.Address.Country;
App.AppData.CurrentCity = e.Result[0].Information.Address.City;
App.AppData.CurrentStreet = e.Result[0].Information.Address.Street;
App.CurrentPosition = e.Result[0].GeoCoordinate;
Helper.SaveAppSetting(App.AppData);
if (string.IsNullOrEmpty(App.AppData.UserId))
{
NavigationService.Navigate(MessageBox.Show(AppResources.UserIdEmptyMsg, AppResources.ApplicationTitle, MessageBoxButton.OKCancel) == MessageBoxResult.OK
? new Uri("/Views/SettingPage.xaml?navCode=userId", UriKind.Relative)
: new Uri("/Views/MainPage.xaml", UriKind.Relative));
}
else
{
NavigationService.Navigate(new Uri("/Views/MainPage.xaml", UriKind.Relative));
}
}
}
答案 0 :(得分:0)
如果你能提供测试报告中给出的信息,那么我们可能会提供更好的帮助,尽管他们的文件通常都是不言自明的。
认证要求是MSDN上的文档,与使用位置的应用相关的认证要求将在第2.7节中介绍。