Preheat your oven to 350 degrees. Spray the 9x13-inch pan well with cooking spray. Do this first so the pan is ready when the batter is.
In a large bowl, whisk the sugar, eggs, oil, and vanilla together. Keep going until the mixture looks smooth and fully combined. This step builds the moist base of the cake.
In a separate bowl, whisk the flour, cinnamon, nutmeg, baking soda, and salt. This spreads the spices and leavening evenly. It also saves you from overmixing later.
Add the dry mixture to the wet mixture. Stir just until no flour streaks remain. The batter will be very thick, and that is exactly right.
Add the chopped apples and pecans to the bowl. Fold them in with a spatula until they are spread evenly. The apples release moisture as the cake bakes, which loosens the batter.
Pour the batter into the prepared pan and smooth the top. Bake for 50 to 55 minutes. Check that a toothpick in the center comes out clean.
Let the cake cool fully in the pan. Frosting a warm cake makes the frosting melt and slide off. I usually wait at least an hour.
Beat the cream cheese and butter in a large bowl until smooth. Add the vanilla, half-and-half, and confectioners' sugar. Beat again until the frosting looks light and creamy.
Spread the frosting over the cooled cake in a thick layer. Slice it into squares and serve. Keep any leftovers in the refrigerator.