美文网首页
Flutter报错_"RuntimeRoot/usr/lib/l

Flutter报错_"RuntimeRoot/usr/lib/l

作者: JxSr程知农 | 来源:发表于2022-05-07 16:32 被阅读0次

1、问题描述

Flutter项目,在iPhone模拟器上运行闪退,报错信息如下:
RuntimeRoot/usr/lib/libswiftCore.dylib' (no such file)

2、分析原因

报错原因是iOS在构建的时候默认是objective-c,而项目引用的部分插件使用的是swift 。

3、解决方法

(1)创建ios/File.swift文件。

//
//  File.swift
//  Runner
//
//  Created by richer on 2019/11/22.
//  Copyright © 2019 The Chromium Authors. All rights reserved.
//

import Foundation

(2)创建ios/Runner-Bridging-Header.h文件。

//
//  Use this file to import your target's public headers that you would like to expose to Swift.
//

(3)编辑ios/Podfile,在 "target 'Runner' do" 后面添加 "use_frameworks!" 。

target 'Runner' do
  use_frameworks!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

相关文章

网友评论

      本文标题:Flutter报错_"RuntimeRoot/usr/lib/l

      本文链接:https://www.haomeiwen.com/subject/hqjxurtx.html