1

アプリをストアに送信したときに、次のコードで常にエラーが発生する理由は誰でも知っています。すべてが開発デバイスで非常にうまく動作します。アプリケーション機能: 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));
            }
        }
    }
4

1 に答える 1

0

テスト レポートに記載されている情報を提供していただければ、より適切なサポートを提供できる可能性があります。

認定要件はMSDNに記載されており、位置情報を使用するアプリに関連する要件はセクション 2.7 で説明されています。

于 2013-10-18T15:30:39.183 に答える