Swift无法导入Sqlite3 iOS [英] Swift Can't Import Sqlite3 iOS

查看:104
本文介绍了Swift无法导入Sqlite3 iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 libsqlite3.0.dylib 添加到我的项目中,然后我尝试使用以下代码导入:

I added libsqlite3.0.dylib to my project, and then I tried to import using the following code:

import UIKit
import sqlite3

class Dataware: NSObject
{

}

但它给了我这个错误:

没有这样的模块'sqlite3'

推荐答案

将它添加到您的Bridging-Header.h文件中:

Add it to your Bridging-Header.h file:

#import <sqlite3.h>

这是导入任何C语言库的主要机制。

This is the primary mechanism for importing any C-language libraries.

如果您还没有Bridging-Header.h文件:

If you don't yet have a Bridging-Header.h file:


  1. 添加文件Bridging-Header .h(或更典型地(ProjectName)-Bridging-Header.h

  2. 转到项目的构建设置选项卡

  3. 查找目标 - C桥接标题。最简单的方法是搜索桥接。

  4. 输入您在第一步中创建的文件的名称和路径。它可能是(ProjectName)/(ProjectName)-Bridging -Header.h

  1. Add a file Bridging-Header.h (or more typically (ProjectName)-Bridging-Header.h
  2. Go to the build settings tab for your project
  3. Find "Objective-C Bridging Header". The easiest way is to search for bridging.
  4. Enter the name and path for the file you created in step one. It's probably (ProjectName)/(ProjectName)-Bridging-Header.h

这篇关于Swift无法导入Sqlite3 iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆