I have created an iOS native app using Swift 5.0, which internally fetch data from the server using background fetch feature of iOS if the App is running in background mode.
Background fetching is working properly in Simulator and http request reaches in the server. But background fetches not at all working in the real device (iPad Air & iOS 12.2). I have enabled Background fetch of 'Background modes' under "Capabilities" on the target in Xcode.
Configured minimum background fecth interval and 'performFetchWithCompletionHandler' method in AppDelegate.swift class
I manually verified that real device has Background Refresh is enabled in App's settings.
But while running the App in a real device the Background Fetch is not working.
Please help me to resolve.
AppDelegate.swift code
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
	 var window: UIWindow?
	 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
			 UIApplication.shared.setMinimumBackgroundFetchInterval(TimeInterval(60*15))
			 return true
	 }
	 func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
			 if let url = URL(string: "http://192.168.225.24:80/product") {
					 URLSession.shared.dataTask(with: url, completionHandler: { (data, respone, error) in
							 guard let `data` = data else { completionHandler(.failed); return }
							 let result = String(data: data, encoding: .utf8)
							 print("performFetchWithCompletionHandler result: \(String(describing: result))")
							 completionHandler(.newData)
					 }).resume()
			 }
	 }
}
Post
Replies
Boosts
Views
Activity
Hello,One of our clients requested us to deploy the Mobile App in the B2B distribution model. All App related services are deployed in the customer's environment (a private network). Due to high confidentiality, none of these services are exposed to the public URL. According to Apple's standard procedure, Apple should review the app with one account credentials (login details provided by us) and will review all screens.As I mentioned, all service URLs used inside the App are private network URLs ( Not exposed to the internet).Then How Apple's review team will login in my app and do the screen review process?Does Apple have any standard specification to review this kind of app? kindly advice.