zoukankan      html  css  js  c++  java
  • Swift开发中的一些琐碎

    1、Swift中使用OC

    • 1.创建 pch 文件,直接引用需要的头文件  #import"SQLite3.h"
    • 2.修改 pct 路径 ,如下图,就可以使用了

       

    2、 Swift 没有系统定义好的宏,想使用DEBUG模式要自己自定义,如下图

      

    3、 自定义print

    • print(__FILE__)     // 获取当前print所在的文件路径
      print(__FUNCTION__) // 获取当前print所在的方法名称
      print(__LINE__)     // 获取当前print所在的行号
    • fun MyLog<T>(message: T, fileName: String = __FILE__, methodName: String = __FUNCTION__, lineNumber: Int = __LINE__) {
          #if DEBUG
              print("((fileName as NSString).pathComponents.last!).(methodName)[(lineNumber)]:(message)")
          #endif
      }
          AppDelegate.swift.application(_:didFinishLaunchingWithOptions:)[24]:ddd
     
     
    4、使用原始图片
     
      
     
    5、Swift 中导入 OC库编译错误
      有时候在swift开发中导入 SnapKit 库 遇到编译错误问题,可能是库的版本太高了,你的Xcode 或者 swift 版本还不支持。将库版本降低就OK了。

    6、使用git的时候 ,当你先 git add .了之后没有 push到远程仓库,之后又修改,git add . 然后在push 的时候 会提示下面错误

         error: failed to push some refs to 'git@git.oschina.net:w_wl/han.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
     
    意思是要你先 git pull 本地merge之后再push 到远程仓库
  • 相关阅读:
    Ajax
    Guitar and Music Theory
    leetcode62 不同路径(Medium)
    leetcode49 字母异位词分组(Medium)
    leetcode3 无重复的最长子串(Medium)
    leetcode69 x的平方根(Easy)
    leetcode300 最长上升子序列(Medium)
    leetcode240 搜索二维矩阵II (Medium)
    leetcode34 在排序数组中查找元素的第一个和最后一个位置(Medium)
    leetcode31 下一个排列(Medium)
  • 原文地址:https://www.cnblogs.com/10-19-92/p/5644570.html
Copyright © 2011-2022 走看看