XLForm icon indicating copy to clipboard operation
XLForm copied to clipboard

Multiple methods named 'count'

Open sedwo opened this issue 7 years ago • 3 comments

In XLFormInlineSelectorCell:(NSString *)valueDisplayText
{
...
        if (!self.rowDescriptor.value || [self.rowDescriptor.value count] == 0){
...
        NSMutableArray * descriptionArray = [NSMutableArray arrayWithCapacity:[self.rowDescriptor.value count]];
}

What should count be cast as?

sedwo avatar Sep 27 '16 15:09 sedwo

For rows of type XLFormRowDescriptorTypeMultipleSelector or XLFormRowDescriptorTypeMultipleSelectorPopover, the value of the rowDescriptor is a NSArray so that count is a NSUInteger.

mats-claassen avatar Oct 18 '16 18:10 mats-claassen

Source code like this

- (BOOL)valueIsEmpty
{
    return self.value == nil || [self.value isKindOfClass:[NSNull class]] || ([self.value respondsToSelector:@selector(length)] && [self.value length]==0) ||
    ([self.value respondsToSelector:@selector(count)] && [self.value count]==0);
}

i'm changed like this

- (BOOL)valueIsEmpty
{
    return self.value == nil || [self.value isKindOfClass:[NSNull class]] || ([self.value respondsToSelector:@selector(length)] && [self.value length]==0) ||
    ([self.value respondsToSelector:@selector(count)] && [(NSArray *)self.value count]==0);
}

but there is an error collide with Foundation NSDictionary NSArray NSSet NSIndex ....

how to fix this ...... ## help

ghost avatar May 15 '17 01:05 ghost

What is the issue with the first code and what are you trying to achieve?

mats-claassen avatar May 15 '17 13:05 mats-claassen