正如我所說的,當我聲明一個變量時出現錯誤。我無法在Google或Swift文檔上找到任何解決方案。 繼承人的代碼:EXC_BAD_ACCESS當聲明一個變量時
class Database {
static let si = Database() // when removed it also resolves into an error
init() {
print("Hello") // isn't printed.
self.setONs() // see code below to see where collected gets a new value
print("current device id: \(UIDevice.current.identifierForVendor!.uuidString)") // resolves into an error when declared as uuid which is now "TestUID"
}
var uuid: String = "TestUID" // its actual the device id.
var gkid: String = "" // GKPlayerID
var collected: [String : [String : Int]] = [:] // <- Thread 1: EXC_BAD_ACCESS(code=2,address=0x7fff59de4f8)
private var collectedProgress: [String : [String : Int]] = [:]
如果我刪除collectedProgress發生在collectedProgress壞的訪問。這兩個變量只能被聲明,不能被寫入或讀取。即使我也刪除了collectProgress變量,下一個變量也會出現相同的錯誤。
我不能重現這個 - 你可以請儘量熬問題降到[MCVE] (並說你正在運行的是什麼版本的Swift) – Hamish
我嘗試將其降至最低。 https://github.com/Aritmetic/Primal這整個項目呢。你不需要設置服務器,因爲在他做任何事情之前,錯誤都會阻止你。 – Aritmetic