android - Ionic 在 android 6 和 IOS 9 中的问题

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

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

第一个问题:我使用 socket.io 来检查用户互联网连接,它在 IOS 9 上始终失败,尽管它在 Android 6 的 ionic view 版本和 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');
                }
            });
        }
    }
}

最佳答案

第一

要检查互联网连接,您可以使用 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();

第二

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

关于android - Ionic 在 android 6 和 IOS 9 中的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39774766/

相关文章:

Android koush ion 库捕获 401 错误

android - 如何在组织内部部署 Android 应用程序?

iphone - 如何按距离升序对 NSmutablearray 进行排序?

cordova - 无法使用cordova-plugin-file-transfer上传base64图像

javascript - AngularJS:如何替换#39;和放大器;带撇号和空白

javascript - 通过点击传递数据以加载模态

java - 如何在Android手机上制作RTSP服务器?

android - Kotlin - 如何在 Handler 中传递一个 Runnable

ios - 从我的可变数组中随机播放一次歌曲

ios - 如何在 cocos2d 中创建带编号的有序文本?