Ich habe den folgenden Code:Verwendung von Stringliteral für Objective-C-Selektoren ist veraltet, verwenden Sie '#selector' statt
func setupShortcutItems(launchOptions: [NSObject: AnyObject]?) -> Bool {
var shouldPerformAdditionalDelegateHandling: Bool = false
if (UIApplicationShortcutItem.respondsToSelector("new")) {
self.configDynamicShortcutItems()
// If a shortcut was launched, display its information and take the appropriate action
if let shortcutItem: UIApplicationShortcutItem = launchOptions?[UIApplicationLaunchOptionsShortcutItemKey] as? UIApplicationShortcutItem {
// When the app launched at the first time, this block can not called.
self.handleShortCutItem(shortcutItem)
// This will block "performActionForShortcutItem:completionHandler" from being called.
shouldPerformAdditionalDelegateHandling = false
} else {
// normal app launch process without quick action
self.launchWithoutQuickAction()
}
} else {
// Less than iOS9 or later
self.launchWithoutQuickAction()
}
return shouldPerformAdditionalDelegateHandling
}
ich folgende "Warnung" auf UIApplicationShortcutItem.respondsToSelector("new")
bekommen, die sagt:
Verwendung von Stringliteral für Objective-c-Selektoren ist veraltet, verwenden Sie '#selector' statt
die Warnung mit dem Code automatisch ersetzt:
UIApplicationShortcutItem.respondsToSelector(#selector(FBSDKAccessToken.new))
jedoch diese nicht kompilieren, weil new()
unavailabe ist. Was soll ich in diesem Fall verwenden?
überprüfen Sie dies ... vielleicht haben Sie etwas http://stackoverflow.com/questions/36147831/syntax-selector-swift-2-2 –
Warum testen Sie für den Selektor "neu"? Ich sehe keinen Code, der die "neue" Nachricht hier sendet. –