If you had bothered to read the complaint, you would have seen that the plaintiffs are suing Apple because Tim and Luca lied during the earnings call, thus defrauding investors. It doesn't matter whether the investors lost money or made money, they still broke the law. Apple and Luca knew demand was softening, and they withheld that information from investors. That's illegal. They violated section 10(b) of the Exchange Act, among others. And it appears they're suing Tim and Luca personally for their illegal conduct.
You know how you avoid a federal class action lawsuit for fraud? You don't commit fraud. It's pretty simple.