Error[8]: Undefined offset: 2, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述当我试图通过在XCode中使用Swift 2检查我的iPhone上的互联网连接,我得到一堆错误。任何人都可以帮助我解决这个问题? 代码: import Foundationimport SystemConfigurationpublic class Reachability {class func isConnectedToNetwork() -> Bool { var zer 当我试图通过在XCode中使用Swift 2检查我的iPhone上的互联网连接,我得到一堆错误。任何人都可以帮助我解决这个问题?

代码:

import Foundationimport SystemConfigurationpublic class Reachability {class func isConnectedToNetwork() -> Bool {    var zeroAddress = sockaddr_in()    zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))    zeroAddress.sin_family = sa_family_t(AF_INET)    let defaultRouteReachability = withUnsafePointer(&zeroAddress) {        SCNetworkReachabilityCreateWithAddress(nil,UnsafePointer(
import SystemConfigurationpublic class Reachability {    class func isConnectedToNetwork() -> Bool {        var zeroAddress = sockaddr_in()        zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))        zeroAddress.sin_family = sa_family_t(AF_INET)        let defaultRouteReachability = withUnsafePointer(&zeroAddress) {            SCNetworkReachabilityCreateWithAddress(nil,UnsafePointer([+++]))        }        var flags = SCNetworkReachabilityFlags()        if !SCNetworkReachabilityGetFlags(defaultRouteReachability!,&flags) {            return false        }        let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0        let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionrequired)) != 0        return (isReachable && !needsConnection)    }}
)) } var flags: SCNetworkReachabilityFlags = 0 if SCNetworkReachabilityGetFlags(defaultRouteReachability,&flags) == 0 { return false } let isReachable = (flags & UInt32(kSCNetworkFlagsReachable)) != 0 let needsConnection = (flags & UInt32(kSCNetworkFlagsConnectionrequired)) != 0 return (isReachable && !needsConnection) ? true : false}}

与代码错误:

如果它不可读,错误1说:

‘Int’ is not convertible to ‘SCNetworkReachabilityFlags’

错误2& 3:

Could not find an overload for ‘init’ that accepts the supplIEd arguments

Xcode 7.0 [+++] 总结

以上是内存溢出为你收集整理的检查互联网连接在Swift 2(iOS 9)全部内容,希望文章能够帮你解决检查互联网连接在Swift 2(iOS 9)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 165, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Error[8]: Undefined offset: 3, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述当我试图通过在XCode中使用Swift 2检查我的iPhone上的互联网连接,我得到一堆错误。任何人都可以帮助我解决这个问题? 代码: import Foundationimport SystemConfigurationpublic class Reachability {class func isConnectedToNetwork() -> Bool { var zer 当我试图通过在XCode中使用Swift 2检查我的iPhone上的互联网连接,我得到一堆错误。任何人都可以帮助我解决这个问题?

代码:

import Foundationimport SystemConfigurationpublic class Reachability {class func isConnectedToNetwork() -> Bool {    var zeroAddress = sockaddr_in()    zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))    zeroAddress.sin_family = sa_family_t(AF_INET)    let defaultRouteReachability = withUnsafePointer(&zeroAddress) {        SCNetworkReachabilityCreateWithAddress(nil,UnsafePointer(
import SystemConfigurationpublic class Reachability {    class func isConnectedToNetwork() -> Bool {        var zeroAddress = sockaddr_in()        zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))        zeroAddress.sin_family = sa_family_t(AF_INET)        let defaultRouteReachability = withUnsafePointer(&zeroAddress) {            SCNetworkReachabilityCreateWithAddress(nil,UnsafePointer())        }        var flags = SCNetworkReachabilityFlags()        if !SCNetworkReachabilityGetFlags(defaultRouteReachability!,&flags) {            return false        }        let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0        let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionrequired)) != 0        return (isReachable && !needsConnection)    }}
)) } var flags: SCNetworkReachabilityFlags = 0 if SCNetworkReachabilityGetFlags(defaultRouteReachability,&flags) == 0 { return false } let isReachable = (flags & UInt32(kSCNetworkFlagsReachable)) != 0 let needsConnection = (flags & UInt32(kSCNetworkFlagsConnectionrequired)) != 0 return (isReachable && !needsConnection) ? true : false}}

与代码错误:

如果它不可读,错误1说:

‘Int’ is not convertible to ‘SCNetworkReachabilityFlags’

错误2& 3:

Could not find an overload for ‘init’ that accepts the supplIEd arguments

Xcode 7.0 [+++] 总结

以上是内存溢出为你收集整理的检查互联网连接在Swift 2(iOS 9)全部内容,希望文章能够帮你解决检查互联网连接在Swift 2(iOS 9)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 165, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
检查互联网连接在Swift 2(iOS 9)_app_内存溢出

检查互联网连接在Swift 2(iOS 9)

检查互联网连接在Swift 2(iOS 9),第1张

概述当我试图通过在XCode中使用Swift 2检查我的iPhone上的互联网连接,我得到一堆错误。任何人都可以帮助我解决这个问题? 代码: import Foundationimport SystemConfigurationpublic class Reachability {class func isConnectedToNetwork() -> Bool { var zer 当我试图通过在XCode中使用Swift 2检查我的iPhone上的互联网连接,我得到一堆错误。任何人都可以帮助我解决这个问题?

代码:

import Foundationimport SystemConfigurationpublic class Reachability {class func isConnectedToNetwork() -> Bool {    var zeroAddress = sockaddr_in()    zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))    zeroAddress.sin_family = sa_family_t(AF_INET)    let defaultRouteReachability = withUnsafePointer(&zeroAddress) {        SCNetworkReachabilityCreateWithAddress(nil,UnsafePointer(
import SystemConfigurationpublic class Reachability {    class func isConnectedToNetwork() -> Bool {        var zeroAddress = sockaddr_in()        zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))        zeroAddress.sin_family = sa_family_t(AF_INET)        let defaultRouteReachability = withUnsafePointer(&zeroAddress) {            SCNetworkReachabilityCreateWithAddress(nil,UnsafePointer())        }        var flags = SCNetworkReachabilityFlags()        if !SCNetworkReachabilityGetFlags(defaultRouteReachability!,&flags) {            return false        }        let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0        let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionrequired)) != 0        return (isReachable && !needsConnection)    }}
)) } var flags: SCNetworkReachabilityFlags = 0 if SCNetworkReachabilityGetFlags(defaultRouteReachability,&flags) == 0 { return false } let isReachable = (flags & UInt32(kSCNetworkFlagsReachable)) != 0 let needsConnection = (flags & UInt32(kSCNetworkFlagsConnectionrequired)) != 0 return (isReachable && !needsConnection) ? true : false}}

与代码错误:

如果它不可读,错误1说:

‘Int’ is not convertible to ‘SCNetworkReachabilityFlags’

错误2& 3:

Could not find an overload for ‘init’ that accepts the supplIEd arguments

Xcode 7.0 总结

以上是内存溢出为你收集整理的检查互联网连接在Swift 2(iOS 9)全部内容,希望文章能够帮你解决检查互联网连接在Swift 2(iOS 9)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1063561.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存