Apple reached a record 20% second-quarter smartphone market share as global shipments fell and the iPhone 17 led worldwide shipments.