質問

こんにちは、

i機内モードがオンかどうかを確認したいのですが、どのように確認しますか?

感謝+ユーザーがWIFIまたはGPRS OR EDGEを使用していることを確認する方法。区別する方法??

役に立ちましたか?

解決

ユーザーが機内モードのときに通知を表示するだけの場合は、アプリのplistファイルでSBUsesNetworkプロパティを有効にするだけで十分です。コードでネットワークを使用している場合、ユーザーは機内モードを自動的にオフにするように求められます。

をご覧ください。 この投稿

他のヒント

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

scroll top