Giter Club home page Giter Club logo

questionandanswer's Introduction

QuestionAndAnswer

about iOS

questionandanswer's People

Contributors

niclas3 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

liuchuo

questionandanswer's Issues

一个简单的问题:不明白书上的这段里面的shareManager是干什么用的

#import "SQLManager.h"

@implementation SQLManager

static SQLManager *manager = nil;

+ (SQLManager *)shareManager {
static dispatch_once_t once;
dispatch_once(&once, ^{
manager = [[self alloc] init];
[manager createDataBaseTableIfNeeded];
});
return manager;
}

-(void)createDataBaseTableIfNeeded {

}

@EnD

代码如上。书上讲的是为了把SQLite的那些操作和代码分离开来,单独创建了一个SQLManager类,首先要创建一个单例shareManager,为什么一定要创建一个shareManager,并不明白创建一个单例方法的理由。。。
最重要的一个问题!
不知道怎么把那个函数体翻译成swift语言。。
大神求教~
是在看慕课网的视频时候看到的问题,地址是http://www.imooc.com/video/11867

配置sqlite的swift框架工程环境

配置swift的环境好像比objective-C的难很多。。。我按照我所能查到的资料已经做了如下工作:
1.在工程里面建立了一个叫sqlite-bridge.h的头文件,并且点击项目名称 - Build Settings- 搜索“bridging” - 单击“Objective-C Bridging Header” - 双击后面后弹出添加文件名,把刚刚创建的头文件名称写进去,书上说这是在添加桥接文件
2.这样运行没有报错,只是我在使用import sqlite3的时候出现了报错,说无法找到模块名,书上说要在工程下面添加一个module文件夹,在里面创建module.map的文件
书上所说的module.map文件里面需要写如下代码:
module sqlite3[system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iphoneOS.sdk/usr/include/sqlite3.h"
link "sqlite3"
export *
}

module sqlite3simulator[system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sqlite3.h"
link "sqlite3"
export *
}
3.然后让在里面写上这些。。。然后我就照做了。。之后还要在配置项里面import path里面添加进去。。我也添加了
4.然后我使用import sqlite3的这个语句,想要开始写数据库的一些操作语句了,写之前我运行了一下
运行的时候产生了报错:
b5db272d-6cdf-4b1e-b85d-4b7e95255371
去stackoverflow里面找了解决方法依旧没有奏效。。并不知道为什么。。。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.