When using AFDXDetector in camera mode, the object automatically compensates for the orientation of the device by rotating the image coming out of the camera appropriately and then passing it to the face detector for detection and tracking.
I am not certain why this wouldn’t be happening in your case. You indicated that you are working on an iMessage App. Is this an iMessage Extension, not an actual app? Can you provide a bit more detail as to the nature of the app?
While not ideal, a workaround is to manage the camera yourself via an AVCaptureDevice object. You would obtain the image and then pass it to the AFDXDetector yourself. It’s certainly more work than relying on the AFDXDetector to manage the camera, you would have complete control of the image as it comes in and could orient properly it before passing it on.