Post

Replies

Boosts

Views

Activity

App raise exception when trigger MOC save
Hello. I'm trying to use the primitive property to save the JSON data and then access the Codable object via custom getter and setter just likes this document: https://developer.apple.com/documentation/coredata/handling_different_data_types_in_core_data But somehow my app raises crash sometimes when I trigger MOC save. The crash log says: Fatal Exception: NSInvalidArgumentException -[__NSCFData count]: unrecognized selector sent to instance 0x2899a1fa0 and the full log in this text file: crash log And it's hard to reproduce the same crash in DEBUG mode and I also have no idea how to trigger it for the release version. It just happens. The app is open-source and the property declared here. The TwitterAttachment is a class adopt NSObject and Codable. And I could make some improvements: add @NSManged private var primitiveAttachments: Data? rather than call setPrimitiveValue method use defer for didChangeValue method call or try the "transformable"… But still no idea about the reason for the crash. Could someone help me find the issue about this crash or any hint about the pitfall about custom Core Data type persistent. Thanks a lot.
0
0
470
May ’23
textAttachmentViewProviders always return empty array
The iOS demo app set comment with attachment. However, call the textAttachmentViewProviders on the fragment return nothing even the image attachment draw on the screen. The inline doc is:     // Returns NSTextAttachmentViewProvider associated with the receiver. The property contents are only valid with NSTextLayoutFragmentStateLayoutAvailable.     open var textAttachmentViewProviders: [NSTextAttachmentViewProvider] { get } I have checked the state. The state is available. How can I get the attachment frame when drawing. Thanks
0
0
561
Jul ’21
The method updateContentSizeIfNeeded not set correct size
The iOS demo project using updateContentSizeIfNeeded to get the layout frame and set the content size for text view. However, it looks like the height is not correct. There is always a huge spacer from the last paragraph to scroll view content bottom. (a.k.a calculated frame large than the real frame. I'm trying to use the TextKit 2 to layout the text without scrolling enabled. Should I use the old way NSAttirubtedString's boundingRect or there is some new method to calculate the frame size. Thanks.
1
0
770
Jul ’21
The demo app get huge memory cost
I download the demo app from: https://developer.apple.com/documentation/uikit/uiimage/building_high-performance_lists_and_collection_views. And build it for iPhone X with iOS 15 beta, Xcode Version 13.0 beta (13A5154h) on macOS 11.4. The memory raise ver quickly when I scroll the list up and down. Then it crash.
0
0
603
Jun ’21