5

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!

  • 1
    The apply the update when you plan releasing for iOS 12.0. IMO you can ignore the warning as long as you haven't supported iOS 12.0 yet. – E-Riddie Aug 27 '18 at 10:58
  • @EridB So, once iOS 12 rolls around and I update the parameter type, this won't cause problems with previous versions of iOS at run time? – Alexander Gingell Aug 27 '18 at 16:55
  • 1
    That this won't cause problems with earlier versions it would mean that iOS is perfect, but them kind of "forcing" us to update it, it will mean that they will take care of that. But also looking close not a big change has been introduced. :) – E-Riddie Aug 28 '18 at 12:03
  • 1
    @EridB Yeah, I mean I kind of see that it wouldn't really be an issue in this case, but I just wondered in general if there was a way to provide a different method signature in different iOS versions. – Alexander Gingell Aug 29 '18 at 13:05

0 Answers0