In iOS 12, the UIApplicationDelegate protocol defines:
- (BOOL) application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
whereas in previous iOS versions this was defined:
- (BOOL) application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
These definitions differ in the parameter type for restorationHandler. Therefore, in Xcode 10, we now receive the warning:
Conflicting parameter types in implementation of 'application:continueUserActivity:restorationHandler:': 'void (^ _Nonnull __strong)(NSArray> * _Nullable __strong)' vs 'void (^__strong _Nonnull)(NSArray *__strong)'
I'm still working on updates that may go out prior to iOS 12, but I'm also laying the groundwork to support iOS 12. I'm unsure how to handle different parameter types across multiple iOS versions.
Normally within a method I would use something like @available to branch the code based on the iOS version detected at run time, but in this case I don't know what the best practice is. I certainly don't want to be swizzling for this! Should I just avoid changing anything yet and live with the warning until Xcode 10 is out of beta and I'm submitting for iOS 12? Will it then be backwards compatible with lesser iOS versions at run time?
Thank you for any help!