hushicai / hushicai.github.io

Blog
https://hushicai.github.io
27 stars 1 forks source link

Symbol not found: AVCaptureSessionPreset3840x2160 #56

Open hushicai opened 5 years ago

hushicai commented 5 years ago

react-native: 0.48.4 react-native-camera: 1.11.1

我们的RN App在IOS 8上一启动就退出,抛出以下异常:

image

排查了一下,原来我们在podfile里边设置了platform :ios, '9.0'

起初以为是platform的问题,尝试将版本降低到8.0,但运行pod update --no-repo-update,发现更新失败:

image

从错误信息上看,react-native-camera的platform不match,它要求ios 9以上:

image

查了一下该podspec文件的commit历史,果然是改过的:

https://github.com/react-native-community/react-native-camera/commit/bdbc2564ba113e1316306333febb1763b1003aaf

按照这个issue的说法,这个AVCaptureSessionPreset3840x2160在ios 9上才有。

image

而RN官方很早之前就放弃支持ios 8了,所以react-native-camera也跟着放弃了,不考虑向后兼容问题。

注:rn 0.48.4版本支持ios 8

于是在ios 8上就跪了。

那么就只能降低react-native-camera版本了。

image

从上图看,降低到v1.3.0-8以下版本应该就可以了。

但是可能会引入其他问题,例如很多已经修复的bug又出来了。。。

当然你也可以放弃ios 8,毕竟连微信、支付宝都只支持ios 9+。

如果一定要支持ios 8,可以去掉AVCaptureSessionPreset3840x2160选项,然后修改podfile platform为8.0即可。