Why does this function using xcode15 crash here and I don't see the definition being cancelled

  • (void)addSubview:(NSView *)view positioned:(NSWindowOrderingMode)place relativeTo:(nullable NSView *)otherView

will crash when NSWindowOrderingMode == NSWindowOut

It is because you pass an invalid positioned parameter.

In documentation: https://developer.apple.com/documentation/appkit/nsview/1483640-addsubview,

place can be NSWindowAbove or NSWindowBelow, not NSWindowOut

positioned place: NSWindow.OrderingMode,

An enum constant specifying the position of the aView relative to otherView. Valid values are NSWindowAbove or NSWindowBelow.

That's the meaning of assertion message.

There is no explanation in the interface documentation that NSWindowOut cannot be used, and there are many places in our online projects that have used this interface before. In recent days, I have seen many users who upgrade to beta system crash because of this reason. I don't know whether this crash will still exist in the official version of Sonoma

This function is normal in xcode14 and earlier version

Why does this function using xcode15 crash here and I don't see the definition being cancelled
 
 
Q