良い一日!
ネットワークアクセス用の関数を呼び出し、ネットワークが存在するかどうかを確認する xcode のプロジェクトで nsthreads を使用したいので、1 分後に実行するスレッドが必要です。接続性。アプリを閉じない限り実行され続けます。
[NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil];
startTheBackgroundJob
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// wait for 3 seconds before starting the thread, you don't have to do that. This is just an example how to stop the NSThread for some time
[NSThread sleepForTimeInterval:5];
//[self performSelectorInBackground:@selector(checkNet) withObject:nil];
[self performSelectorOnMainThread:@selector(checkNet) withObject:nil waitUntilDone:YES];
[pool release];
それは初めて機能しますが、他の機能はありません。つまり、ループは1つだけです
誰かがこの点で私を助けることができます.
ありがとう