How to consistently send data to server with interval time while app has been terminated?
You don’t. There are two parts to this:
If the user removes your app from the multitasking UI, the system interprets that as a strong signal that the user does not want your app running in the background . That state persists until the user next runs your app manually.
Even if you ignore the above, iOS does not provide a general way for apps to run periodically in the background. There are specific mechanism that do allow you to run in the background, but no general purpose way to get background execution time every N minutes.
… sending data with interval 1000 seconds to the server …
Just to be clear, you are not going to be able to accomplish this task. You will have to rethink your approach.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
 The system may actually run your app in the background in this state under specific circumstances, but this general rule applies.
Thank you for the quick explanation on my questions for sending generic data to the server in a consistent pace while the app has been terminated. I read through the document on background modes for apps for the link I attached above.
From my understanding of your explanation, beginBackgroundTaskWithName , WithExpirationTime function won't work in actually background mode but instead in a short period of moment when the user killed the app. And it also confused me a little bit on the approach of dealling with general data, it documented as "Background fetch".
The app regularly downloads and processes small amounts of content from the network.
It seems the fetch method would get the signal from system and wait to be awaken while user next time runs the app. -> no way to execute the fetch on the background(app has been killed), let alone in a regular(periodly) time.
Considering special cases such as bluetooth and corelocation data, bluetooth for example, Uses Bluetooth LE accessories bluetooth-central
The app works with a Bluetooth accessory that needs to deliver updates on a regular schedule through the Core Bluetooth framework. (https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html)
I believe it could be accomplished in corebluetooth framework to send the data in background mode on regular basis. If you have relevent latest sample demo code regarding my issue, would be appreciated if you could attach the link here.
Backgrounding and killing an app are two different things. Backgrounding an app does not kill the app if the app is configured to run in the background.
As to using BLE to wake the app, a connected BLE device would be needed to wake the app on a regular basis.
For power saving reasons, iOS does not support polling like you want. You need to rethink your architecture. What are you really trying to do?
Thank you for correcting my understanding about the background mode. My team lead mislead me on the understanding of the background mode. Originally I thought background mode is staging on user pressed the home buttom, and it would be miracle that developer could still operating the code in the dead ios app. But since the android developer implemented that mode and named it background mode. Therefore, my lead the background mode is the stage that app has been killed, and I need to sending data at interval time during that stage.
Based on your statement, I think it makes much sense. Then I assume, all the apple documents that indicate the Background Mode is actually the stage that the user pressed the home buttom.
Thanks again for your time.