JWT decoding error occurs only when building release with Xcode16

It uses the SwiftJWT library. When decoding JWT, I get the error "JWT verifier failed to verify the JWT String signature". This occurs when building Release with Xcode16. It does not occur on Debug builds or Xcode15. Please tell me how to solve it

Answered by DTS Engineer in 813983022

OK. But there’s meta advice in that post. When you encounter problems in a third-party library, you have two options:

  • You can seek help from the library vendor.

  • If the library is open source, and you’re so inclined, you can ‘take ownership’ of the problem and debug it yourself.

The latter means digging into the code to work out why it’s failing. It could be a compiler bug but my experience is that problems like this most often caused by the code relying on undefined behaviour, typically with unsafe pointers.

The good news here is that have an easily reproducible case. The bad news is that the debugger won’t be super helpful in the optimised code. That means debugging this with test vectors and logging.

I’m happy to offer advice on this front, but I can’t do this for you.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It’s not uncommon to encounter bugs that only show up in optimised code. Indeed, this came up recently with a different crytpographic library on another thread. Check out my advice there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you for your reply. I tried it, but the error still occurred. I tried adjusting all the settings that have differences between debug and release to debug in other setting items in Build Settings, but the problem was not resolved.

OK. But there’s meta advice in that post. When you encounter problems in a third-party library, you have two options:

  • You can seek help from the library vendor.

  • If the library is open source, and you’re so inclined, you can ‘take ownership’ of the problem and debug it yourself.

The latter means digging into the code to work out why it’s failing. It could be a compiler bug but my experience is that problems like this most often caused by the code relying on undefined behaviour, typically with unsafe pointers.

The good news here is that have an easily reproducible case. The bad news is that the debugger won’t be super helpful in the optimised code. That means debugging this with test vectors and logging.

I’m happy to offer advice on this front, but I can’t do this for you.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

JWT decoding error occurs only when building release with Xcode16
 
 
Q