2016-09-05 4 views
0

그래서이 스위프트 2에서 완벽하게 작동하지만, 스위프트 3에 문제가 있습니다스위프트 3 지역 알림 - 자동 시간대 설정은

func myNotifications() { 
    let interval = 2.0 
    var daysOut = 2.0 
    let myArray =getArray() 
    for i in 0..<myArray.count { 
     let message = ("\(myArray[i])\n-\(myArray[i])") 
     let localNotification = UILocalNotification() 
     localNotification.fireDate = Date(timeIntervalSinceNow: (60*60*24*daysOut)) 
     localNotification.alertBody = message 
     localNotification.timeZone = NSTimeZone.autoupdatingCurrent 
     localNotification.category = "Message" 
     UIApplication.shared.scheduleLocalNotification(localNotification) 
     daysOut += interval 
    } 

    let arrayCount = Double(myArray.count) 
    let lastNotif_Date = Date(timeIntervalSinceNow: (60*60*24*interval*(quoteCount+1))) 
    userPref_NSDefault.set(lastNotif_Date, forKey: "notification_EndDate") 
} 

특히,이 라인은 더 이상 내가 사용자를 가지고 있기 때문에 큰 문제가되는 일을

유형 "NSTimeZone"했습니다

localNotification.timeZone = NSTimeZone.autoupdatingCurrent 

내가 오류 메시지가 : 여러 시간대와 나는 확실히이 작품 만들고 싶어 회원이 아니며 "autoUpdatingCurrent"

아이디어가 있으십니까? 나는 "timeZone.automatic", ".automatic"및 몇 가지 다른 변형을 시도했지만이를 파악하지 못했습니다.

+1

로 이름이 바뀌 었습니다'localNotification.timeZone = TimeZone.autoupdatingCurrent' –

+0

UILocalNotification는 감사 일 그 iOS10 –

+1

에서 더 이상 사용되지 않습니다. 이상하게도 자동 마이그레이션이이를 처리하는 것이 간단했다면 생각했을 것입니다. 그러나 UILocalNotification이 더 이상 사용되지 않는다고 말하는 경우 도로 아래에서 더 큰 문제를 겪게됩니까? –

답변

1
  1. autoupdatingCurrent! = autoupdatingCurrent
  2. NSTimeZoneTimeZone
+0

예, 오류 메시지에 대문자 U가 ​​표시되어 있지만 오타가 있습니다. – MirekE