IOS引用ScanKit.framework华为扫描遇到的问题`
iOS项目导入sdk后在打包,送审上遇到一些问题
问题 1
1、scankit.framework引入,编译报错,需要配置
解决方案:
1、导入sdk到项目
targets- general - framework
选择Embed&Sign
2、targets- build phases - Embed Framework
按照下图操作
这样在真机上运行不会报错了。
问题2
1、如果在代码中有用到原生页面,如
HmsScanOptions,HmsDefaultScanViewController等,可能会在打包的时候报错
报错内容忘记截图了,主要原因是standard Architectures是arm64 和arm7,但是华为的扫描sdk只支持arm64
解决方案
1、targets - build settings - user defined -
点击+
VALID_ARCHS arm64
2、build phases - run script
将下面代码写入
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done
这样打包就不会报错了
问题3、送审的过程中报错
主要原因是证书问题
1、重新在本地生成一个证书
2、生成新的Profiles
OK了