The spam protection in both iOS and Android in general works even without an internet connection. The phone should be able to connect to the internet every now and then to give the app the chance to download the latest spam numbers. To provide caller identification (caller ID) the app needs an internet connection to be able to access various directories.