1 Reply
      Latest reply on Sep 20, 2019 2:34 AM by eskimo
      sasibala Level 1 Level 1 (0 points)

        After copy, when we do Pointer difference check ,for NSDate variable failed.

        @interface TestDef : NSObject<NSCopying>

        ...

         

            TestDef *original = [[TestDef alloc] init];

            TestDef *copied = [original copy];

             XCTAssertNotEqual(original.Date, copied.Date);

        • Re: NSCopying for NSDate variable broken in iOS13
          eskimo Apple Staff Apple Staff (12,325 points)

          After copy, when we do Pointer difference check, for NSDate variable failed.

          Your test isn’t valid.  NSDate objects are immutable, so -copy is allowed to just increment the reference count.  Moreover, on modern systems you’ll find that NSDate is actually implemented using tagged pointers, so it doesn’t even allocate memory.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"