Preheat the oven to 350°F (175°C). Grease a 9-inch round cake pan and line the bottom with parchment paper.
In a medium bowl, whisk together the flour, baking powder, baking soda, salt, and cinnamon.
In a large bowl, beat the softened butter and granulated sugar for 2 to 3 minutes until light and creamy.
Add the eggs one at a time, mixing well after each addition. Mix in the vanilla extract and sour cream.
Gradually add the dry ingredients and mix just until combined. Avoid overmixing.
Gently fold the diced apples into the batter until evenly distributed.
Spread the batter evenly into the prepared cake pan.
To make the crumb topping, combine the flour, brown sugar, cinnamon, and salt. Stir in the melted butter until large, moist crumbs form. Fold in the chopped pecans if using.
Sprinkle the cinnamon brown sugar crumbs generously and evenly over the apple cake batter.
Bake for 45 to 55 minutes, or until a toothpick inserted into the center comes out clean or with a few moist crumbs.
Let the cake cool in the pan for about 15 minutes before transferring it to a serving plate. Allow it to cool slightly before slicing.