ho il seguente codice:L'uso della stringa letterale per selettori Objective-C è deprecato, usare '#selector' invece
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
}
ricevo il seguente "warning" su UIApplicationShortcutItem.respondsToSelector("new")
, che dice:
l'uso della stringa letterale per Objective-C selettori è deprecato, l'uso '#selector' invece
l'avviso sostituisce automaticamente il codice con:
UIApplicationShortcutItem.respondsToSelector(#selector(FBSDKAccessToken.new))
Tuttavia questo non compila perché new()
è unavailabe. Cosa dovrei usare in questo caso?
verifica questo ... potresti avere qualcosa http://stackoverflow.com/questions/36147831/syntax-selector-swift-2-2 –
Perché stai testando il selettore 'new'? Non vedo alcun codice che invii il messaggio 'new' qui. –