当我第一次在iphone上安装whatsapp时,当我打开它时,第一个屏幕已经知道我的SIM卡位置并显示国家代码.whatsapp如何知道这一点?由于苹果拒绝所有以编程方式使用SIM卡信息的应用程序.
我试着以这种方式获取路由器地址.
- (NSString *) routerIp {
NSString *address = @"error";
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
// retrieve the current interfaces - returns 0 on success
success = getifaddrs(&interfaces);
if (success == 0)
{
// Loop through linked list of interfaces
temp_addr = interfaces;
while(temp_addr != NULL)
{
if(temp_addr->ifa_addr->sa_family == AF_INET)
{
// Check if interface is en0 which is the wifi connection on the iPhone
if([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"])
{
// Get …Run Code Online (Sandbox Code Playgroud)