BlackBerry shares plunged nearly 30 percent after the company posted a loss and warned of future losses.