我已經看過了這些錯誤了一天的解決方案,現在,我不知道如何解決這些問題。下面的代碼接收多個錯誤消息:預計「」分隔符和未解決的標識符
使用在線路未解決標識符NSCalendarUnitDay
的:
localNotification.repeatInterval = NSCalendarUnitDay
和三個錯誤:
- 預期」, '分隔符
- 使用未解決的識別符 'sharedApplication'
- 使用未解決的識別符的 'applicationBadgeNumber'
在行:
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
這是整個代碼:
override func viewDidLoad() {
super.viewDidLoad()
var localNotification:UILocalNotification = UILocalNotification()
localNotification.fireDate = datePicker.date
localNotification.alertBody = nil;
localNotification.alertAction = nil;
localNotification.repeatInterval = NSCalendarUnitDay
//Add one to the icon badge number
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
好了,代碼仍然是一半的Objective-C。 – Sulthan
從Objective-C代碼複製&粘貼[[UIApplication sharedApplication] applicationIconBadgeNumber]'? – DevAndArtist
任何想法如何我可以重寫它,或者我可以讀到它是如何完成的? – Gjeruldsen