1

I'm fairly new to iOS Programming and I'm developing an App which will ping a specified server every 5 minutes and let the user know whether the server is up. So far I have been able to get everything working properly as long as the App is in the foreground and as soon as it's moved to the Background State it will not work. The problem is, I really have no idea which Background Mode I should select as none of those modes describe what App's function. I'm aware that I can accomplish this by creating a simple PHP script (Executed by CRON every 5 mins) which will ping the server and will send a APNS, But is there anyway I can accomplish what I'm trying to do without using APNS ? Thank you very much.

4

1 に答える 1

1

いいえ、できません。あなたの場合、唯一の解決策はを使用することPush Notificationsです。

Local notificationsメソッドを呼び出してサーバーに ping を実行する必要があるため、これはオプションではありませんが、iOS ではアプリがBackgroundモードでコードを実行することはできません。メソッドを使用できますbeginBackgroundTaskWithExpirationHandlerが、実行は10 分に制限されています

于 2013-09-04T06:27:34.590 に答える