NEW YORK—A federal judge on Wednesday dismissed a proposed class-action lawsuit accusing Apple Inc. of misleading consumers about how resistant its iPhones are to water exposure. Apple’s advertisements had made various claims about the iPhone’s resistance to damage when submerged or otherwise exposed to water, including that some models could survive depths of 4 meters…