benim app temsilci gayet güzel çalışıyorclassName.type adlı bir üye yok 'appDel'
let appDel: AppDelegate = (UIApplication.sharedApplication().delegate) as AppDelegate
bir başvuru var, ama aşağıda kod satırı bir hata veriyor:
let context: NSManagedObjectContext = appDel.managedObjectContext
'vctGebruikers.Type' does not have a member named 'appDel'
Birazdan böyle Dersimde bunları aşağıda bildirilen:
bana şu hatayı veriyor
class vctGebruikers: UIViewController, UITableViewDelegate, UITableViewDataSource {
let appDel: AppDelegate = (UIApplication.sharedApplication().delegate) as AppDelegate
let context: NSManagedObjectContext = appDel.managedObjectContext
}
Tuhaf olan şey kodu viewDidLoad
'a yapıştırdığımda veya bir işlevde kodun düzgün çalıştığı zamandır. Ve sorunun ne olduğunu anlayamıyorum. Bu hatayı nasıl çözebilirim?
DÜZENLEME:
init(coder aDecoder: NSCoder!) {
let appDelegate = (UIApplication.sharedApplication().delegate) as AppDelegate
self.appDel = appDelegate
self.context = appDelegate.managedObjectContext
super.init(coder: aDecoder)
}
yapmak 'bir bilgisayarlı' get' özelliğini appDel' - bu sayesinde çalışıyor daha mantıklı – kambala