Git Product home page Git Product logo

bbs's Introduction

BBS

Swift编写的iOS端和服务器端, 服务器端基于Perfect框架

iOS端地址: https://github.com/zedxpp/BBS-iOS

服务器端地址: https://github.com/zedxpp/BBS-Server

注: 运行BBS-iOS, 如果你用的是我的服务器地址, 在帖子详情里面有很大的图片情况下, 加载的时候, 会卡一会, 服务器水管小. 没办法 T-T

已完成的接口

  • 注册
  • 登录
  • 所有帖子列表
  • 论坛列表
  • 帖子详情
  • 帖子评论列表
  • 评论帖子
  • 发布帖子
  • 上传图片
  • 获取当前用户信息
  • ...

以下教程编译环境

Apple Swift version 4.0.3

查看方式, 打开终端, 输入swift --version

mysql Ver 14.14 Distrib 5.7.19(mysql5.6版本也兼容)

输入mysql --version

使用方式

点个star不迷路 ^-^

让iOS端跑起来

  1. clonepod install, 项目是基于cocoapods的.

  2. 安装好后直接运行即可.

注:

如果用这个地址, 需要把BBS-Server项目 clone到本地, 自己运行起来, 也就是用你的mac当服务器

let httpAdress = "http://0.0.0.0:8181/"

如果用这个地址, 直接运行BBS-iOS项目即可 这个云服务器快到期了, 所以尽量结合 BBS-Server 项目查看iOS端的demo

let httpAdress = "http://swift520.com:8181/"

配置文件在BBS-iOS/Tool.swift

让服务端跑起来

  1. clone项目, 并且cd到项目目录, swift build编译项目(如果你的终端没有翻墙, 那么这个过程会很慢)
  2. 编译完成, 会出现Linking ./.build/x86_64-apple-macosx10.10/debug/BBS-Server这样的log输出. 直接拷贝./.build/x86_64-apple-macosx10.10/debug/BBS-Server, 运行即可.

过程如图:

  1. 安装本地MySql, 请看此文章 点我 只需要看安装部分即可, 安装完成后, 用命令启动数据库, 终端输出Starting MySQL . SUCCESS!, 本地mysql服务启动完成.

  2. 安装Navicat PremiumMac App, 请自行网上搜索安装.

  3. Navicat Premium, 新建mysql连接, 连接成功后, 打开数据库. 按下面的图, 新建一个bbs的数据库, 参数请务必和我图上的一致. 然后运行bbs.sql文件. 见下方图片.

  1. 导入sql成功后, 在iOS端的BBS-iOS/Tool.swift切换为let httpAdress = "http://0.0.0.0:8181/", 并且把BBS-Server/Sources/BBS-Server/ServerConfiguration.swift的数据库相关配置设置一下, 在没有更改端口号之类的情况下, 你需要填写你的数据库用户名和密码既可.
struct ServerConfiguration {
    let baseURL =  "http://localhost/" // 本地地址
    let name = "localhost"  
    let mysqlDBName  = "bbs"  // 数据库名
    let mysqlHost = "127.0.0.1" // 数据库本地地址
    let mysqlPort = 3306 // 默认端口号
    let mysqlPwd = "" // 数据库密码
    let mysqlUser = ""  // 数据库用户名
    let httpPort =  8181 // 服务器默认端口号
}
  1. 重新运行BBS-ServerBBS-iOS项目. 现在, 服务器和数据库, 都是用的你mac上的了.

这两个小demo, 写了快两个月吧, 有很多细节地方没来得及完善, 同时写两端, 并且在不会用Perfect框架的情况下, 速度很慢了.

如果你也想在mac或者服务器上部署一个属于自己的app后端, 请看我的Perfect框架使用系列文章, 戳我戳我http://zedxpp.com

bbs's People

Contributors

zedxpp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bbs's Issues

swift build报错

/Users/xuetianhhb/Downloads/BBS-Server-master/.build/checkouts/Perfect-mysqlclient.git-5333716826204139417/module.modulemap:2:12: error: header '/usr/local/include/mysql/mysql.h' not found
header "/usr/local/include/mysql/mysql.h"
^
/Users/xuetianhhb/Downloads/BBS-Server-master/.build/checkouts/Perfect-MySQL.git-4976130768219902098/Sources/PerfectMySQL.swift:25:8: error: could not build Objective-C module 'mysqlclient'
import mysqlclient
^
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/xuetianhhb/Downloads/BBS-Server-master/.build/debug.yaml main
xuetianhhbdeMac-mini:BBS-Server-master xuetianhhb$

报错了0.0

ld: library not found for -lmysqlclient for architecture x86_64 这个错,,而且我数据库运行出错呢。。

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.