You used pointer comparison ( ==
), and now you need to use the object comparison method. This means that in earlier versions of iOS, the earlierDate:
method returned the object you passed earlier. Now, it seems, a new object is created (with the same data as the earlier date), and returns this.
The isEqualToDate:
method isEqualToDate:
preferable because it is more suitable, and is less likely to break, as the comparison with the pointer did.
source share