在Singleton中使用SwiftyJSON

时间:2015-03-19 20:35:39

标签: ios swift swifty-json

我正在尝试使用SwiftyJSON存储一些JSON数据,但一直遇到编译错误。

import Foundation
import SwiftyJSON

class CurrentUser {
    private struct SubSruct {
        static var currentUser: JSON? = nil
    }

    private init(){

    }

    class var currentUser: JSON? {
        get { return SubSruct.currentUser }
        set { SubSruct.currentUser = newValue }
    }
}

具体而言,发生以下编译器错误:Command failed due to signal: Segmentation fault: 11

如果我将类型从JSON更改为其他任何内容,编译器错误就会消失(我已经尝试了AnyObjectNSDictionary)。

如何解决此问题?

0 个答案:

没有答案
相关问题