Long story short: For several years the tourist apartment business has been exponentially growing in Barcelona. Legally speaking, if you're getting any income from doing business with your apartment(s) you need to declare it in your equivalent to US's 1042 (in our case is the 100 form). Many, too many, didn't. No declaring = no tax revenue for the government.
Furthermore, greediness made some owners not too care much who they rented to and too often uncivilized tourists made life hell for the neighbours -especially in certain districts. While indeed these are a tiny minority of the visitors to the city, when you have someone next door partying 24hrs, leaving trash and filth everywhere, vomiting and peeing in your building's portal, etc and this happening day after day... you end up exploding. So in 2014 street demonstrations by neighbours of La Barceloneta district were staged demanding and end to this situation.
http://www.theguardian.com/world/2014/aug/21/naked-italians-protests-drunken-tourists-barcelona (**)
http://www.euronews.com/2014/08/22/barcelona-residents-protest-against-anti-social-behaviour/
http://news.yahoo.com/barcelona-locals-rebel-drunken-naked-tourist-high-jinks-141639796.html
The Catalan Government took action by instating a Registry to which all tourist apartments and villas must be registered and defined a "grace period" (I believe ends in 2017) for current owners to do that voluntarily. After that, no HUTB will mean "illegal" and they'll be able to close them down if necessary. It'll also mean no new tourist apartments unless a license is granted first so it'll be possible to control and distribute the flats across the city.
http://www.20minutos.es/noticia/1525088/0/barcelona/apartaments/turistics/
I do agree with djp_syd that one shouldn't expect trouble with a serious agent -even if the flat is not yet registered- and I wouldn't worry too much (just yet). I can't either imagine the government creating a problem by closing down hundreds of apartments at once, I guess it'll be rather a matter of fining owners instead. But it's all guess of course.
By the way, the Registry for all tourist establishments legally registered in Barcelona and the whole of Catalonia can be checked here: http://bit.ly/1FBy5wk
But again, LET'S NOT BLOW THINGS OUT of proportion... there is no problem whatsoever with the vast majority of visitors nor there are complains from the vast majority of Barcelonians either, in fact, we very proud to be able to show and share our city with whomever visits (and respect is all it's asked in return!)
PS: (**)... this British paper got it wrong, nudity is not a problem, drunkenness and anti-social behaviour is. We Catalans are very open on sexual matters: topless is very common in Catalan beaches, in Barcelona itself there even are a couple of beaches in which nudity is practiced and until recently City Regulations allowed nudity in the city (now it's limited to the nudist beaches)