小编Dav*_*vid的帖子

为什么Google Maps API无法在服务器上运行?[错误:地理定位服务失败]

目前我只是将我的网站上的内容上传到测试服务器,如果谷歌地图API工作,它本地免费,并显示我当前的位置.但是,当我将我的网站上传到服务器并修改了所有必要的内容以使一切看起来都很好时,Google Maps API的这一部分就停止了正常运行.

谷歌地图api代码:

function initMap() {
        var map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 12
        });
        var infoWindow = new google.maps.InfoWindow({map: map});

        // Try HTML5 geolocation.
        if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(function(position) {
            var pos = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };


            infoWindow.setPosition(pos);
            infoWindow.setContent('Esta es tu ubicacion');
            map.setCenter(pos);


            var icon = {
    url: "vista/multimedia/imagenes/pointer.png", // url
    scaledSize: new google.maps.Size(30, 30), // scaled size
    origin: new google.maps.Point(0,0), // origin
    anchor: new google.maps.Point(0, 0) // anchor
};

var marker …
Run Code Online (Sandbox Code Playgroud)

javascript api google-maps

7
推荐指数
2
解决办法
8046
查看次数

把很棒的字体图标放在c#代码后面

目前,我可以使用 XAML 代码中的选项卡测量页面上令人印象深刻的字体图标,如下所示:

<ContentPage.IconImageSource>
    <FontImageSource  FontFamily="{StaticResource Solid }" Glyph="&#xf108;" ></FontImageSource>
</ContentPage.IconImageSource>
Run Code Online (Sandbox Code Playgroud)

这样我就可以在我的应用程序中放置图标,但我想从代码隐藏中进行,因为必须从某些操作中创建该选项卡式页面,并且我以以下方式进行了操作:

 contenido.IconImageSource  = new ContentPage().IconImageSource {
    new FontImageSource().FontFamily = "\uf108";
};
Run Code Online (Sandbox Code Playgroud)

但是在第一个“{”中,我收到错误消息“我希望有一个;”

更新

代码 App.xaml

<Application.Resources>
    <ResourceDictionary>
        <!--Global Styles-->
        <Color x:Key="NavigationPrimary">#2196F3</Color>
        <Style TargetType="NavigationPage">
            <Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
            <Setter Property="BarTextColor" Value="White" />
        </Style>

        <OnPlatform x:TypeArguments="x:String" 
            x:Key="Brands">
            <On Platform="Android" 
      Value="BrandsRegular.otf#Regular" />
        </OnPlatform>

        <OnPlatform x:TypeArguments="x:String" 
            x:Key="Regular">
            <On Platform="Android" 
      Value="FreeRegular.otf#Regular" />
        </OnPlatform>

        <OnPlatform x:TypeArguments="x:String" 
            x:Key="Solid">
            <On Platform="Android" 
      Value="FreeSolid.otf#Regular" />
        </OnPlatform>


    </ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

xamarin xamarin.forms

5
推荐指数
1
解决办法
491
查看次数

标签 统计

api ×1

google-maps ×1

javascript ×1

xamarin ×1

xamarin.forms ×1