I Debugged Xcode for Hours. The Bug Was in My Joi Schema.
My first iOS app got rejected by Apple.
Reason: "Error when logging in with Apple account."
I had seen the exact same error a few days before. That time, it was a missing capability in Xcode. So I assumed the same cause.
I spent hours checking:
- Provisioning profile
- App ID capability
- Distribution certificate
- Sign in with Apple key
- Bundle ID
Everything was fine.
Then I opened the server logs.
POST /apple/login → 400
The request was reaching the server with all the data. But the server was returning 400.
The real cause? During a refactoring session with an AI coding tool, a Joi validation middleware was added. The schema was missing one field that the client was sending — identityToken.
The controller never ran. Joi blocked it silently.
The fix was one line.
identityToken: Joi.string().required()
I wrote about the full debugging process, the wrong assumptions I made, and what I learned about reviewing AI-generated code.
Top comments (0)