Security crew, while the ones to enforce the rules, are not necessarily trained in them.  Bringing any food, other than factory sealed food, onboard a ship that calls at US ports, is a technical violation of USPH requirements.  While it is true that the ship gets their fruit and produce from shore, it must come from verifiable and certified sources, which your apple may or may not be provable to be.