Unable to build iOS framework

I am unable to compile the latest OpenCV from source to build the iOS framework (with opencv_contrib). Appreciate any help. Thanks a lot.

MacOS version: 12.3 (Monterey)
Xcode version: 13.4.1
CMake version: 3.24.1
python version: 3.8.5

Command:
python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib --iphoneos_archs arm64 --iphonesimulator_archs x86_64

Errors:
/Users/…/opencv/ios/build/build-arm64-iphoneos/lib/Release/opencv2.framework/Headers/TEBLID.h:21:5: error: redefinition of enumerator ‘SIZE_256_BITS’
SIZE_256_BITS = 102,
^
/Users/…/opencv/ios/build/build-arm64-iphoneos/lib/Release/opencv2.framework/Headers/BEBLID.h:22:5: note: previous definition is here
SIZE_256_BITS = 101

/Users/…/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/aruco/ArucoDetector.mm:35:123: error: use of undeclared identifier ‘DICT_4X4_50’; did you mean ‘cv::aruco::DICT_4X4_50’?

ERROR: Command ‘[‘xcodebuild’, ‘BITCODE_GENERATION_MODE=bitcode’, ‘IPHONEOS_DEPLOYMENT_TARGET=9.0’, ‘ARCHS=arm64’, ‘-sdk’, ‘iphoneos’, ‘-configuration’, ‘Release’, ‘-parallelizeTargets’, ‘-jobs’, ‘8’, ‘-target’, ‘ALL_BUILD’, ‘build’]’ returned non-zero exit status 65.