Getting several errors in BNRItemStore.m


#1

I’m getting several errors in Homepwnr BNRItemStore.m:

Error 1:

  • (BNRItem *)createItem
    {
    double order;
    if ([self.allItems count] == 0) {
    order = 1.0;
    } else {
    order = [[self.privateItems lastObject] orderingValue] + 1.0; [color=#FF0000]Invalid operands to binary expression (‘double *’ and ‘double’)[/color]
    }
    NSLog(@“Adding after %d items, order = %.2f”, [self.privateItems count], order);

    BNRItem *item = [NSEntityDescription insertNewObjectForEntityForName:@“BNRItem” inManagedObjectContext:self.context];

    item.orderingValue = order; [color=#FF0000]Assigning to ‘double *’ from incompatible type ‘double’; take the address with &[/color]

    [self.privateItems addObject:item];

    return item;
    }

Error 2:

  • (void)moveItemAtIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex
    {
    if (fromIndex == toIndex) {
    return;
    }
    // Get pointer to object being moved so you can re-insert it
    BNRItem *item = self.privateItems[fromIndex];

    // Remove item from array
    [self.privateItems removeObjectAtIndex:fromIndex];

    // Insert item in array at new location
    [self.privateItems insertObject:item atIndex:toIndex];

    // Computing a new orderValue for the object that was moved
    double lowerBound = 0.0;

    // Is there an object before it in the array?
    if (toIndex > 0) {
    lowerBound = [self.privateItems[(toIndex - 1)] orderingValue]; [color=#FF0000]Assigning to ‘double’ from incompatible type ‘double *’; dereference with *[/color]
    } else {
    lowerBound = [self.privateItems[1] orderingValue] - 2.0; [color=#FF0000]Invalid operands to binary expression (‘double *’ and ‘double’)[/color]
    }

    double upperBound = 0.0;

    // Is there an object after it in the array?
    if (toIndex < [self.privateItems count] - 1) {
    upperBound = [self.privateItems[(toIndex + 1)] orderingValue]; [color=#FF0000]Assigning to ‘double’ from incompatible type ‘double *’; dereference with *[/color]
    } else {
    upperBound = [self.privateItems[(toIndex - 1)] orderingValue] + 2.0; [color=#FF0000]Invalid operands to binary expression (‘double *’ and ‘double’)[/color]
    }

    double newOrderValue = (lowerBound + upperBound) / 2.0;

    NSLog(@“moving to order %f”, newOrderValue);
    item.orderingValue = newOrderValue; [color=#FF0000]Assigning to ‘double *’ from incompatible type ‘double’; take the address with &[/color]
    }

I don’t understand why no one else is having this problem, am I missing something?


#2

Nevermind, I found the problem. When core data generated BNRItem.h and BNRItem.m, it inserted ‘*’ for some reason in orderingValue and and valueInDollars properties.