作者:
Adonisy (堂本瓜一)
2017-06-08 12:08:41最近手殘把 Swift 2.X 的專案升級到 Swift 3.X
不得不說,一升級時 compile發現有 140個 warning與43個 error
我的尿都閃了出來... WTF...
這個 error 也未免太多了吧
後來大概循幾個方向解決
1.把xcode的 source code control 關掉,warning少了一些
menu 有 source control可以設定為關掉
2.把用 pod 抓的 framework砍掉,再重新安裝一次
結果 chart 該死的 framework 3.0版竟然結構大改,花了好久時間重改函數
主要是 LineChart的 X軸竟然無法設定文字,只能用數字
搜了半天才知道可以這麼改:
lineChartView.xAxis.valueFormatter = IndexAxisValueFormatter
(values: dataPoints)
//dataPoints為字串陣列
lineChartView.xAxis.granularity = 1
另外把加入的 framework Build Active Architecture Only 設定成NO
(不然會出現 i386的錯誤訊息)
3.從 sqlite資料庫中的文字欄位,現在要寫成這樣:
let test_name = String(cString: sqlite3_column_text(statement, 1))
終於升級完成了... 看來我舊的 object-c的程式,還是重寫算了... orz