对于iPhone应用程序,我需要在启动时确定用户所在的国家/地区.据推测,我将不得不打开位置服务并进行某种反向地理编码.如果可能的话,我真的不想使用第三方网络服务,是否有任何其他建议来确定服务提供的位置?
最初,我只需要检查用户是否在美国境内,但是将来可能会更改以添加更多国家/地区.我知道无法始终确定位置或用户可能已关闭位置服务.基本上,我只需要知道用户是否被检测到是在美国境内,以便关闭特定功能.
编辑:进一步阅读,它看起来像MKReverseGeocoder,除了我不希望在我的应用程序中显示任何地图,这意味着我不允许使用它.
从iOS 5.X开始,我曾经使用这些方法获取无线电信息:在iOS 5.1中获取CellID,MCC,MNC,LAC和网络
但是使用iOS 8.3 beta(和8.3 GM),这个私有API
_CTServerConnectionCellMonitorCopyCellInfo
不再起作用了.
我想检索一些蜂窝网络信息,例如 cellId 和 LAC。我知道没有官方方法可以做到这一点,但我仍然遇到一些 CoreTelephony 例程,例如 CTServerConnectionGetCellID。
有运气让这个工作吗?
有什么帮助吗?
我需要获得MCC与MNC当前的国家(而不是从类CTCarrier的SIM本国)代码.
我使用私有API CoreTelephony.framework.在我的设备上一切正常.但是在CellMonitorCallback我们获得的方法中的其他设备上cells = NULL.
可能有人可以帮我做错了吗?
#import "AMCoreTelephone.h"
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
struct CTResult
{
int flag;
int a;
};
extern CFStringRef const kCTCellMonitorCellType;
extern CFStringRef const kCTCellMonitorCellTypeServing;
extern CFStringRef const kCTCellMonitorCellTypeNeighbor;
extern CFStringRef const kCTCellMonitorCellId;
extern CFStringRef const kCTCellMonitorLAC;
extern CFStringRef const kCTCellMonitorMCC;
extern CFStringRef const kCTCellMonitorMNC;
extern CFStringRef const kCTCellMonitorUpdateNotification;
id _CTServerConnectionCreate(CFAllocatorRef, void*, int*);
void _CTServerConnectionAddToRunLoop(id, CFRunLoopRef, CFStringRef);
mach_port_t _CTServerConnectionGetPort(id);
#ifdef __LP64__
void _CTServerConnectionRegisterCallService(id);
void _CTServerConnectionUnregisterCallService(id,int*);
void _CTServerConnectionRegisterForNotification(id, CFStringRef); …Run Code Online (Sandbox Code Playgroud) 如何在ios 8.3中使用私有api获取cell id,因为之前的核心电话私有api在最新的ios sdk 8.3中不起作用.
有没有办法确定iPhone是否支持CDMA或GSM网络.Objective-C中的任何Apple API都可以提供此信息.