大佬教程收集整理的这篇文章主要介绍了ios – 我收到一个警告,说我在模拟后台提取时从未调用完成处理程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Warning: Application delegate received call to - application: performFetchWithCompletionHandler:but the completion handler was never called.
这是我的代码:
func application(application: UIApplication,performFetchWithCompletionHandler completionHandler: (UIBACkgroundFetchResult) -> Void) { if let tabBarController = window?.rootViewController as? UITabBarController,viewControllers = tabBarController.viewControllers as [UIViewController]! { for viewController in viewControllers { if let notificationViewController = viewController as? NotificationsViewController { firstViewController.reloadData() completionHandler(.NewData) print("BACkground fetch done") } } } }
如何测试BACkground-fetchis是否正常工作?
func application( application: UIApplication,performFetchWithCompletionHandler completionHandler: @escaping (UIBACkgroundFetchResult) -> Void ) { guard let tabBarController = window?.rootViewController as? UITabBarController,let viewControllers = tabBarController.viewControllers else { completionHandler(.Failed) return } guard let notificationsViewController = viewControllers.first(where: { $0 is NotificationsViewController }) as? NotificationsViewController else { completionHandler(.Failed) return } notificationViewController.reloadData() completionHandler(.newData) }
以上是大佬教程为你收集整理的ios – 我收到一个警告,说我在模拟后台提取时从未调用完成处理程序全部内容,希望文章能够帮你解决ios – 我收到一个警告,说我在模拟后台提取时从未调用完成处理程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。