I am trying to define this method
- (void)backgroundFetchWithCompletion:(void(^)(UIBackgroundFetchResult))completionHandler;
However I am getting an error on UIBackgroundFetchResult saying a parameter list without types is only allowed, I was following this tutorial and this tutorial and that is how they define their method.
After executing some operation at the end you must call one in list.
Objective-C
completionHandler(UIBackgroundFetchResultNewData);
completionHandler(UIBackgroundFetchResultFailed);
completionHandler(UIBackgroundFetchResultNoData);
Swift
completionHandler(.NewData)
completionHandler(.Failed)
completionHandler(.NoData)
Full Examples:
Objective-C
Swift
Just make sure you import UIKit.h in header file:
[edit] This was an older answer of mine, refer to AbdullahDiaa's answer below for a better/more correct resolution.
I was just experiencing the same issue, and the solution was to add this to the file where the method with that block was defined:
#import "AppDelegate.h"