iOS运行cupertino_http示例应用遇_wrapListenerBlock_1a6kixf解析错误
解决cupertino_http iOS示例运行报错:无法解析native函数_wrapListenerBlock_1a6kixf
错误信息
flutter: The Dart VM service is listening on http://127.0.0.1:53003/tmg2xds8gus=/ [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Couldn't resolve native function '_wrapListenerBlock_1a6kixf' in 'package:cupertino_http/src/native_cupertino_bindings.dart' : No asset with id 'package:cupertino_http/src/native_cupertino_bindings.dart' found. No available native assets. Attempted to fallback to process lookup. dlsym(RTLD_DEFAULT, _wrapListenerBlock_1a6kixf): symbol not found. #0 Native._ffi_resolver.#ffiClosure0 (dart:ffi-patch/ffi_patch.dart) #1 Native._ffi_resolver_function (dart:ffi-patch/ffi_patch.dart:1523:20) #2 wrapListenerBlock_1a6kixf (package:cupertino_http/src/native_cupertino_bindings.dart) #3 ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError.listener (package:cupertino_http/src/native_cupertino_bindings.dart:65985:21) #4 NSURLSessionDataDelegate.URLSession_task_didCompleteWithError. (package:cupertino_http/src/native_cupertino_bindings.dart:66922:14) #5 ObjCProtocolListenableMethod.implementAsListener (package:objective_c/src/protocol_builder.dart:80:69) #6 URLSession.delegate (package:cupertino_http/src/cupertino_api.dart:854:10) #7 new URLSession.sessionWithConfiguration (package:cupertino_http/src/cupertino_api.dart:1070:13) #8 new CupertinoClient.fromSessionConfiguration (package:cupertino_http/src/cupertino_client.dart:240:32) #9 main (package:cupertino_http_example/main.dart:23:34) #10 _runMain. (dart:ui/hooks.dart:301:23) #11 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:297:19) #12 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
解决步骤
- 升级依赖并匹配版本:执行
flutter pub upgrade cupertino_http,确保Flutter版本在3.10以上(cupertino_http对Flutter版本有最低要求) - 清理项目并重新构建:
- 运行
flutter clean清空缓存 - 删除iOS目录下的Pods和锁文件:
rm -rf ios/Pods ios/Podfile.lock - 进入iOS目录执行
pod install重新安装原生依赖,之后返回项目根目录 - 重新运行项目:
flutter run
- 运行
- 确认Native Assets支持:Flutter 3.10及以上版本默认开启Native Assets,无需额外配置;若使用旧版本,需升级Flutter
- 检查开发环境:确保Xcode版本在14.3以上,iOS模拟器/真机系统版本不低于iOS 13.0
- 重新克隆示例项目:若本地示例文件损坏,直接克隆官方仓库的示例代码,进入对应目录重新执行依赖安装和运行操作
内容的提问来源于stack exchange,提问作者Shubham Gupta
相关产品推荐
相关产品推荐

