是否可以在电话上访问提供商列表?
我已经找到了房屋供应商。但是尚不清楚如何看待其他提供商。
struct InfoProvider {
let networkOperator: String
let country: String?
let mobileCountryCode: String?
let mobileNetworkCode: String?
}
func getHomeProvider() -> InfoProvider? {
var homeProvider: InfoProvider? = nil
let networkInfo = CTTelephonyNetworkInfo()
if let carrier = networkInfo.subscriberCellularProvider {
if let carrierName = carrier.carrierName {
homeProvider = InfoProvider(networkOperator: carrierName,
country: carrier.isoCountryCode,
mobileCountryCode: carrier.mobileCountryCode,
mobileNetworkCode: carrier.mobileNetworkCode)
}
}
return homeProvider
}
func getProviders() -> [InfoProvider] {
var providers = [InfoProvider]()
// home provider record
if let homeProvider = self.getHomeProvider() {
providers.append(homeProvider)
}
/*
recording of other providers
*/
return providers
}