Hello, I'm trying to complete my project for iOS. My application consist in a webview that show pages from my remote server. The application should manage barber bookings. All is working good, but I want that the user must recive a notification when in the current day it has an appointment.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType([.Alert, .Badge, .Sound]),categories: nil)
application.registerUserNotificationSettings(settings);
/
UIApplication.sharedApplication().setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
return true
}
func application(application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
print("Complete");
notifcationSystem();
completionHandler(UIBackgroundFetchResult.NewData)
}Here is how I handled background fetch, but it seems that it don't work always. The function "notificationSystem()" make a web request and read the content. Any suggestions? I want that the app send max 1 request every hour but at least 1 every 2 hours.. How can I handle that?