background-fetch

Background fetch performFetchWithCompletionHandler not working?

霸气de小男生 提交于 2021-01-29 10:34:19
问题 My app want to update server about users location after every 5 seconds even if app is in background. I implemented Background fetch for it. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)) application.setMinimumBackgroundFetchInterval(5.0) return true } func application(application:

DownloadTask gets paused while executing as part of the Background Fetch, if app is not in the foreground?

陌路散爱 提交于 2020-06-28 20:25:44
问题 I need to perform a task periodically, once a day to be exact, so I implemented background fetch with minimumBackgroundFetchInterval of 23 hours. It gets done when I simulate background fetch with my app in the foreground. But when my app is in the background only the application(_ application:, performFetchWithCompletionHandler) method gets called like it should be, and the urlSession(_ session:, downloadTask:, didFinishDownloadingTo:) method either doesn't get called at all or gets called

Using URLSession and background fetch together with remote notifications using firebase

天大地大妈咪最大 提交于 2020-01-21 19:15:48
问题 I am trying to implement a basic func here which will be called when my app is backgrounded or suspended. In reality, we aim to send about 5 a day so Apple should not throttle our utilisation. I've put together the following which uses firebase and userNotifications, for now, it is in my app delegate. import Firebase import FirebaseMessaging import UserNotifications @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var

how to call function after every 1 hour?(Swift). Background fetch work when app is terminated?

允我心安 提交于 2020-01-10 02:59:33
问题 i am making app. which providing functionality of fetch data after every one hour. so even when my app terminate how can i call that function? after too much searching i found Background fetching by performFetchWithCompletionHandler but i want to know that this function will work if my app is terminated?what i mean is if my app is in closed or terminated state how can i call function automatically? 回答1: You can't do anything if your app is in terminated state. Apple is not allowing anything

How to run background process for background fetch mode in iOS App?

让人想犯罪 __ 提交于 2019-12-25 07:26:23
问题 I have made a service in android native with the help of Broadcast receiver and schedule it with the Alarm Manager and this service runs in background at every 5 minutes interval. This service is running even when app is closed/terminated/forced quit or device is restarted.Its working fine as per my requirement. But now I want to run same background process in iOS app , means my service should run in background when app is closed or mobile device is rebooted also. Is it possible in iOS app to

iOS background fetch not working

荒凉一梦 提交于 2019-12-25 03:14:01
问题 I want to pull some data from server in every 30 min interval and set local notification to remind the user and i implemented below code to perform this operation. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; return YES; } -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult

Background fetch stops working after about 10 to 14 hours

左心房为你撑大大i 提交于 2019-12-24 04:06:42
问题 My application uses a backgroud fetch to send and upload a small portion of data every 30 minutes. The service is working correctly for about 10 - 14 hours after the application is minimized from working in the foregroud - the application is correctly sending and receiving the data every 30 minutes. Does anyone know what happens with the service after couple of hours? Does the iOS system automatically terminate the application and therefore the background fetch stops working? Can anyone

Remote Notification callback not being called during phone call

拟墨画扇 提交于 2019-12-23 07:37:01
问题 I have created an app in which background fetch code is written on receiving push notification. I have enabled the background mode in .plist, content-available key is set to 1 in push notification payload, registered for push notification and using delegate - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler Now when my app is in background, I receive a call.

PerformFetchWithCompletionHandler called twice when simulating with Xcode

纵然是瞬间 提交于 2019-12-20 10:17:12
问题 In Xcode 7.0.1 the "simulate background" fetch command causes performFetchWithCompletionHandler to be triggered twice. Is this an Xcode debugging error, or can this happen on a device running a release build of the application. Update Now we have Xcode 7.1.1 and still performFetchWithCompletionHandler is called twice. Since I am not sure if this also happens "in the wild" I am keeping a state if my fetch action is already running. - (void)application:(UIApplication *)application

iOS10 Background fetch

左心房为你撑大大i 提交于 2019-12-18 02:42:48
问题 I have tried to implement background fetch, to hopefully can wake the app from time to time. I have done these: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum) return true } func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) ->