I have found a line in my code that doesn't like to be run on iOS8, but have a way to perform the same task on iOS8 with different logic, that doesn't like iOS9.
I have used if #available(iOS 9, *)
to perform the code I need on iOS9 and code on iOS8. However, when running, after a few calls to the function, the iOS9 device runs the code it shouldn't and crashes. Did I miss step in setting up the if #available(iOS 9, *)
?
The code is below
if #available(iOS 9, *) {
if(self.otherChats[loc].last?.timestamp! != messageObj.timestamp!){
self.otherChats[loc].append(messageObj)
self.Notfication.postNotificationName(_Chat.Notification.DidGetMessage, object: nil)
}
} else {
self.otherChats[loc].append(messageObj)
self.Notfication.postNotificationName(_Chat.Notification.DidGetMessage, object: nil)
}