React Expo构建iOS应用时SENTSDK Pod缺失Info.plist报错求助
解决Expo裸工程中SENTSDK Pod编译时Info.plist缺失问题
以下是针对该问题的分步解决方案:
1. 重新安装Pod,确保依赖完整性
- 删除iOS目录下的
Pods文件夹和Podfile.lock文件 - 进入iOS目录:
cd ios - 执行Pod清理命令:
pod deintegrate - 重新安装Pod:
pod install(或使用Expo推荐的npx pod-install) - 完成后回到项目根目录,重新执行
npx expo run:ios
如果重新安装后问题依旧,说明Pod本身的XCFramework包可能存在缺失,继续以下步骤。
2. 手动创建缺失的Info.plist文件
在路径/Users/username/Documents/Projects/sentiance-rn-expo/ios/Pods/SENTSDK/SENTSDK.xcframework下创建Info.plist文件,内容可参考标准XCFramework配置(根据实际SDK版本调整版本号):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleIdentifier</key> <string>com.sentiance.sdk</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>SENTSDK</string> <key>CFBundlePackageType</key> <string>XFWK</string> <key>CFBundleShortVersionString</key> <string>5.0.0</string> <key>CFBundleVersion</key> <string>5.0.0</string> <key>MinimumOSVersion</key> <string>12.0</string> </dict> </plist>
创建完成后重新执行构建命令。
3. 检查Pod兼容性并修复配置
- 确认
@sentiance-react-native/core版本是否支持Expo裸工程,尝试升级或降级到官方标注兼容Expo的版本 - 若兼容性存在问题,可在iOS目录的
Podfile中添加post_install钩子,自动生成缺失的Info.plist:
post_install do |installer| installer.pods_project.targets.each do |target| next unless target.name == 'SENTSDK' xcframework_path = target.product_reference.real_path info_plist_path = File.join(xcframework_path, 'Info.plist') next if File.exist?(info_plist_path) File.write(info_plist_path, <<~PLIST) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleIdentifier</key> <string>com.sentiance.sdk</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>SENTSDK</string> <key>CFBundlePackageType</key> <string>XFWK</string> <key>CFBundleShortVersionString</key> <string>5.0.0</string> <key>CFBundleVersion</key> <string>5.0.0</string> <key>MinimumOSVersion</key> <string>12.0</string> </dict> </plist> PLIST end end
修改Podfile后重新执行pod install和构建命令。
内容的提问来源于stack exchange,提问作者cyanbird
相关产品推荐
相关产品推荐

