Before iOS 7, the iPhone didn't support blocking texts from spammers, exes and other unwanted contacts. Even apps couldn't perform the job, short of a few tweaks that required . On an updated phone, however, the feature is built into the system, so there's no need to break your warranty or buy a new app -- just pick someone from your messages or contacts to block.
Block an Unfamiliar Number
Open any message from the number you want to block in the Messages app on iOS 8, and tap Details.
Press the i button to see the texter's info page.
Scroll to the bottom of the page, tap Block This Caller and choose Block Contact to confirm.
Block a Contact
Open the Messages section of the Settings app and tap Blocked.
Tap Add New to pick a contact from your contact list. Picking a contact adds all of the contact's phone numbers and email addresses to your blocked list.
Swipe from right to left along any individual entries you want to remove, and press Unblock. You can remove one phone number or email address from the list while leaving the others blocked, even if they all come from the same contact.