If you suspect that your iPhone or iPad has a virus, don't panic. Apple has made it really difficult for hackers to get into your devices. So, instead of thinking your device is the problem, think smaller.
You may have a buggy app. Do advertisements keep popping up on your screen? Does Safari redirect you to the App Store?
If so, a hacker may have infected an app you're using. That would be good news. An app is easy to get rid of.
What problems are you having that make you think you have a virus? Whatever it is, pay attention the next time it happens. Do these annoying problems happen only when one specific app is open? It's possible an app developer may have used a development kit infected with a virus.
How to get rid of a buggy app
First, check the App Store to see if there's a newer version of your problem app. It may have fixed the problem. If that doesn't work, delete the app: From your home screen, press down on the app until all the apps start wobbling >> If there's a little X in the upper left corner of the app, touch it.
Note: To avoid problems on your iPhone or iPad, don't jailbreak it. That means you're bypassing Apple's security to download unauthorized apps. Apps that aren't in the App Store may not be scrutinized by Apple. So, you're putting your devices, your privacy and your security at risk.