【问题标题】:Problems with Ionic in android 6 and IOS 9android 6 和 IOS 9 中的 Ionic 问题
【发布时间】:2016-09-29 15:47:30
【问题描述】:

我有一个跨平台的 Ionic 应用程序, 我在针对 APK 版本正确运行的 ionic view 应用程序视图中遇到一些问题

第一个问题:我正在使用 socket.io 来检查用户的互联网连接,它在 IOS 9 上一直失败,尽管它在 ionic view 版本的 android 6 和 APK 版本上运行良好

第二个问题:图标在 android 6 和 IOS 9 上不可点击,虽然它是 APK 版本

<i class="icon ion-ios-download-outline"
                       external-link="result.file.uri"></i>

external-link 是指向点击链接的指令 它适用于APK版本 有什么帮助吗?

** 编辑

externalLink 指令代码

angular.module('ivf.directives').directive('externalLink', ExternalLinkDirective);

function ExternalLinkDirective() {
    return {
        restrict: 'A',
        scope: false,
        link: function ($scope, $element, $attrs) {
            $element.click(function ($event) {
                if ($event.isDefaultPrevented()) return;

                var link = $scope.$eval($attrs['externalLink']);
                if (link) {
                    window.open(link, '_system');
                }
            });
        }
    }
}

【问题讨论】:

  • 寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定的问题或错误以及在问题本身中重现它所需的最短代码.
  • 请显示externalLink指令代码

标签: android ios ionic-framework cross-platform ionic-view


【解决方案1】:

第一个

要检查互联网连接,您可以使用Cordova Plugin Network Information

Example from documentation:

function checkConnection() {
    var networkState = navigator.connection.type;

    var states = {};
    states[Connection.UNKNOWN]  = 'Unknown connection';
    states[Connection.ETHERNET] = 'Ethernet connection';
    states[Connection.WIFI]     = 'WiFi connection';
    states[Connection.CELL_2G]  = 'Cell 2G connection';
    states[Connection.CELL_3G]  = 'Cell 3G connection';
    states[Connection.CELL_4G]  = 'Cell 4G connection';
    states[Connection.CELL]     = 'Cell generic connection';
    states[Connection.NONE]     = 'No network connection';

    alert('Connection type: ' + states[networkState]);
}

checkConnection();

第二次

您说的是哪些图标?请出示您的代码

【讨论】:

    猜你喜欢
    • 2016-07-24
    • 2016-01-13
    • 1970-01-01
    • 1970-01-01
    • 2015-12-14
    • 2015-12-16
    • 1970-01-01
    • 1970-01-01
    • 2016-04-02
    相关资源
    最近更新 更多