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

2022-05-07  本文已影响0人  JxSr程知农

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
上一篇 下一篇

猜你喜欢

热点阅读