En Xcode 6, ce code a bien fonctionné, mais dans Xcode 7gm, j'obtiens une erreur qui indique:erreur Downcast dans Xcode 7
Downcast de [UILocalNotification]? à '[UILocalNotification]' ne déballe que les options; vouliez-vous utiliser '!'?
L'erreur se produit pour la ligne où j'ai placé deux astérisques. Dans Xcode, il y a aussi un petit triangle rouge sous le a
de la partie as!
.
func removeItem(item: TodoItem) {
**for notification in (UIApplication.sharedApplication().scheduledLocalNotifications as! [UILocalNotification]) { // loop through notifications...
if (notification.userInfo!["UUID"] as! String == item.UUID) { // ...and cancel the notification that corresponds to this TodoItem instance (matched by UUID)
UIApplication.sharedApplication().cancelLocalNotification(notification) // there should be a maximum of one match on UUID
break
}
}
qui ont fixé le! Merci beaucoup! – James