SOair
SOair

Reputation: 173

Xcode - Error occurs when compiling app in 64-bit

I am working with Xcode and have changed my app to compile in 32 and 64-bit, this has caused errors to occur.

I am getting the error: "Multiple methods named "count" found with mismatched result, parameter type or attributes"

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return [self.sections count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [[self.sections objectAtIndex: section]  count];
}

I believe this is caused by the 64-bit version no longer viewing them as the same type.

The error occurs inside the second function. Is this a matter of simply type casting? If so what should I be casting 'count' to?

Thanks guys.

Upvotes: 0

Views: 82

Answers (1)

Tanuj
Tanuj

Reputation: 531

The compiler doesn't know which method this object responds to. You send a "count" message. The compiler goes through all the count methods of all classes that it knows about. If there are more than two different ones, it has to complain.

You could write

NSArray *tempArray=[self.sections objectAtIndex: section];
return [tempArray  count];

Upvotes: 1

Related Questions