سؤال

I am creating an iphone application which i need to stop a running thread if the application went to background mode,is it possible to stop thread in iphone application? as because my thread displays location notification alert messages continuously if application enter to foreground .

Please help me if any one knows. Thanks in advance.

هل كانت مفيدة؟

المحلول

If your app was switched to the background, the OS will let you know by calling one of your delegate's methods:

- (void)applicationDidEnterBackground:(UIApplication *)application {

Your app won't be frozen right away. You can immediately contact your server (if any) or any controller within your app and stop displaying notifications.

btw: I suggest you first test your app on a real device to see how it behaves when switched to the background. It is possible that the OS will freeze that thread for you. Nothing might have to be done on your side.

نصائح أخرى

This Tutorial will guide you what you want to achieve.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top