iphone how to check the Airplane mode?

后端 未结 4 1275
旧时难觅i
旧时难觅i 2020-12-09 19:43

HI ,

i want to check wether Airplane mode is on or not .. how to check that ?

thanks + how to check that the user is using WIFI or GPRS OR EDGE . how to di

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 20:34

    For SDK 3.0

    (http://bbs.51pda.cn/simple/?t4861.html)

    #import unistd.h
    #include dlfcn.h
    #include stdio.h
    
    typedef int (*airType)();
    static int (*real_air)() = NULL;
    
    int main(int argc, char **argv)
    {
    
    int status = 0;
    void *libHandle = dlopen("/System/Library/PrivateFrameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
    real_air = (airType)dlsym(libHandle, "CTPowerGetAirplaneMode");
    
    if(! real_air)
    {
    printf("something wrong");
    }
    else
    {
    status = real_air();
    }
    
    printf("%d",status);
    
    return status;
    }
    

    debian:~# arm-apple-darwin9-gcc -lobjc -bind_at_load -F"/System/Library/PrivateFrameworks" -framework CoreTelephony test.c -o test

提交回复
热议问题