Catalan is spoken by approximately 50-60% of the inhabitants of Barcelona. Spanish is spoken by 98% of people living in the city.
It is true that out of those 50-60% of people who speak Catalan, many of them are more comfortable in Catalan than in Spanish, but they will almost all be bilingual.
So, you will be able to communicate with more people if you learn Spanish than Catalan. Not being able to speak Catalan will rarely hold you back. But not speaking Spanish may do - many workers in Barcelona's bars and cafes are from South America and do not speak Catalan.
The only time you might run into problems is in the select few restaurants that decide to put their menus only in Catalan. But as these people are deliberately excluding the 40-50% of people in the city who don't speak Catalan, do you really want to be eating there?
So my advice if you are visiting Barcelona is to learn Spanish, not Catalan. But why not learn a few polite words and phrases in Catalan? The locals will really appreciate the effort!