Flutter项目iOS工程构建失败 【Undefined symbols for architecture arm64】

Flutter项目iOS工程构建失败 【Undefined symbols for architecture arm64】

错误描述:flutter sdk升级到2.0后构建iOS工程就一直失败,报错的是我的一个扩展工程(app Extension)报错如下:

Undefined symbols for architecture arm64:
OBJC_CLASS$_FlutterStandardTypedData”, referenced from:
objc-class-ref in flutter_baidu_mapapi_map(BMFMapViewHandles.o)

OBJC_CLASS$_FlutterStandardMessageCodec”, referenced from:
objc-class-ref in aliyun_video_player(CameraViewFactory.o)
objc-class-ref in flutter_baidu_mapapi_map(BMFMapViewController.o)

OBJC_CLASS$_FlutterError”, referenced from:
objc-class-ref in aliyun_video_player(CameraView.o)
objc-class-ref in aliyun_video_player(AliyunVideoPlayerPlugin.o)
objc-class-ref in dim(DimPlugin.o)
objc-class-ref in fluwx(FluwxPlugin.o)
objc-class-ref in ios_image_manager(IosImageManagerPlugin.o)
objc-class-ref in iosvideomanager(IosvideomanagerPlugin.o)
objc-class-ref in permission_handler_apple(PermissionHandlerPlugin.o)

OBJC_CLASS$_FlutterMethodChannel”, referenced from:
objc-class-ref in aliyun_video_player(CameraView.o)
objc-class-ref in aliyun_video_player(AliyunVideoPlayerPlugin.o)
objc-class-ref in dim(DimPlugin.o)
objc-class-ref in flutter_baidu_mapapi_base(FlutterBmfbasePlugin.o)
objc-class-ref in flutter_baidu_mapapi_map(BMFMapViewController.o)
objc-class-ref in flutter_baidu_mapapi_map(BMFOfflineMapManager.o)
objc-class-ref in flutter_baidu_mapapi_map(FlutterBmfmapPlugin.o)

OBJC_CLASS$_FlutterEventChannel”, referenced from:
objc-class-ref in aliyun_video_player(AliyunVideoPlayerPlugin.o)
objc-class-ref in aliyun_video_player(VideoPlayerPlugin.o)
objc-class-ref in aliyun_video_player(CameraViewFactory.o)
objc-class-ref in dim(DimPlugin.o)
“_FlutterMethodNotImplemented”, referenced from:
-[CameraView onMethodCall:result:] in aliyun_video_player(CameraView.o)
-[FLTVideoPlayerPlugin handleMethodCall:result:] in aliyun_video_player(VideoPlayerPlugin.o)
-[DimPlugin handleMethodCall:result:] in dim(DimPlugin.o)
-[FlutterBmfbasePlugin handleMethodCall:result:] in flutter_baidu_mapapi_base(FlutterBmfbasePlugin.o)
___83-[BMFMapViewController initWithWithFrame:viewIdentifier:arguments:binaryMessenger:]_block_invoke in flutter_baidu_mapapi_map(BMFMapViewController.o)
-[BMFOfflineMapManager handleMethodCall:result:] in flutter_baidu_mapapi_map(BMFOfflineMapManager.o)
-[FlutterBmfmapPlugin handleMethodCall:result:] in flutter_baidu_mapapi_map(FlutterBmfmapPlugin.o)

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Flutter项目iOS工程构建失败 【Undefined symbols for architecture arm64】_第1张图片

不同项目引入的插件不同,报错也不同但是差不多是这样子的。

问题分析:

字面意思就是链接不到一些仓库,但是我只是修改了flutter的部分,按理说是不应该影响过到原生构建的。

并且报错的是扩展工程,删除扩展工程后主工程是可以正常运行的。

由于自己本身是Android开发,对iOS了解不多所以采用比较原始的方法,创建新的工程再把代码一点一点的添加过去,通过不断对比终于找到问题所在。

解决:

找到如下配置项:

Targets->[app extension] ->build settings ->linking ->other linker flags

Flutter项目iOS工程构建失败 【Undefined symbols for architecture arm64】_第2张图片

删除该选项后项目可以正常运行。

不知道这个配置项是怎么变化的,可能是升级Xcode导致的,也可能是某次构建导致的吧。

如果有知道问题产生原因的人,可以留言给我,谢谢

你可能感兴趣的:(Flutter,iOS,flutter)