My project is using Texture on production. I want to migrate my dependency manager from Cocoapods to Tuist. All dependency are good, but when I first run my project I got this error:
`Assertion failure in IMP ASReplaceMethodWithBlock(__unsafe_unretained Class _Nonnull, SEL _Nonnull, __strong id _Nonnull)(), ASInternalHelpers.mm:106`.
I look on the Texture source code and see that this block make the program crash:
#if ASDISPLAYNODE_ASSERTIONS_ENABLED
if (self != [ASDisplayNode class]) {
// Subclasses should never override these. Use unused to prevent warnings
__unused NSString *classString = NSStringFromClass(self);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedSize)), @"Subclass %@ must not override calculatedSize method.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedLayout)), @"Subclass %@ must not override calculatedLayout method.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(layoutThatFits:)), @"Subclass %@ must not override layoutThatFits: method. Instead override calculateLayoutThatFits:.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(layoutThatFits:parentSize:)), @"Subclass %@ must not override layoutThatFits:parentSize method. Instead override calculateLayoutThatFits:.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(recursivelyClearContents)), @"Subclass %@ must not override recursivelyClearContents method.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(recursivelyClearPreloadedData)), @"Subclass %@ must not override recursivelyClearFetchedData method.", classString);
} else {
// Check if subnodes where modified during the creation of the layout
__block IMP originalLayoutSpecThatFitsIMP = ASReplaceMethodWithBlock(self, @selector(_locked_layoutElementThatFits:), ^(ASDisplayNode *_self, ASSizeRange sizeRange) {
NSArray *oldSubnodes = _self.subnodes;
ASLayoutSpec *layoutElement = ((ASLayoutSpec *( *)(id, SEL, ASSizeRange))originalLayoutSpecThatFitsIMP)(_self, @selector(_locked_layoutElementThatFits:), sizeRange);
NSArray *subnodes = _self.subnodes;
ASDisplayNodeAssert(oldSubnodes.count == subnodes.count, @"Adding or removing nodes in layoutSpecBlock or layoutSpecThatFits: is not allowed and can cause unexpected behavior.");
for (NSInteger i = 0; i < oldSubnodes.count; i++) {
ASDisplayNodeAssert(oldSubnodes[i] == subnodes[i], @"Adding or removing nodes in layoutSpecBlock or layoutSpecThatFits: is not allowed and can cause unexpected behavior.");
}
return layoutElement;
});
}
#endif
I realize that from my previous config, this block doesn't run. And ASDISPLAYNODE_ASSERTIONS_ENABLED is asserted from this:
So, I set ENABLE_NS_ASSERTIONS to NO for TextureSwiftSupport package config. And this error is gone.
But then I got new error whenever I init any node that inherit from ASDisplayNode.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TextureSwiftSupport.NamedDisplayNodeBase scheduleIvarsForMainThreadDeallocation]: unrecognized selector sent to instance 0x13c01c000'
My project is using Texture on production. I want to migrate my dependency manager from Cocoapods to Tuist. All dependency are good, but when I first run my project I got this error:
I look on the Texture source code and see that this block make the program crash:
I realize that from my previous config, this block doesn't run. And
ASDISPLAYNODE_ASSERTIONS_ENABLED
is asserted from this:So, I set
ENABLE_NS_ASSERTIONS
toNO
forTextureSwiftSupport
package config. And this error is gone.But then I got new error whenever I init any node that inherit from
ASDisplayNode
.I still don't have any clue about this exception. Here my sandbox to reproduce this crash: https://github.com/98prabowo/TextureDebug
Xcode: 15.4 Texture: 3.0.2 TextureSwiftSupport: 3.20.1