2012-03-01 40 views
3

私はアプリケーションでbeginBackgroundTaskWithExpirationHandlerを使用しています。私の理解バックグラウンドアプリケーションが作業を完了するために与えられた最大時間は10分ですが、私はbackgroundTimeRemainingの値を印刷したときに私が得たことは(35791394分)であるbackgroundTimeRemaining returns(35791394分)?

NSTimeInterval timeLeft = [UIApplication sharedApplication].backgroundTimeRemaining; 
    NSLog(@"Background time remaining2222: %.0f seconds (%d mins)", timeLeft, (int)timeLeft/60); 

が、これが普通なのか、私が何か間違ったことをしたようです?!

答えて

1

このお試しください:

NSLog(@"Background time remaining: %f seconds (%d mins)", timeLeft, (int)(timeLeft/60)); 
2

試してください:あなたのコードのtimeleftには

NSLog(@"Background time remaining2222: %.0f seconds (%d mins)", timeLeft, (int)(timeLeft/60)); 

はありません後、除前にint型に変更されています。