1

このようなことの実行を遅らせるのは簡単です

double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    <#code to be executed on the main queue after delay#>
});

ただし、次のような別の長い遅延を設定すると、上記のコードの実行に失敗します

double delayInSeconds2 = 3.0;
dispatch_time_t popTime2 = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds2 * NSEC_PER_SEC);
dispatch_after(popTime2, dispatch_get_main_queue(), ^(void){
    <#code to be executed on the main queue after delay#>
});

両方ではなく、長い方を実行するのはなぜですか? それとも私は完全に間違っていますか?

4

1 に答える 1